Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRebecca Turner <me@re-becca.org>2017-09-23 02:50:25 +0300
committerRebecca Turner <me@re-becca.org>2017-10-04 10:02:38 +0300
commitd13ea47c862c9e8040efaaffe0766b2b81b3b25d (patch)
tree20f1b379f65c75ff60f1bff1d5039fb0cc44ebad
parenta60a79625fa7dc21bca2a0ac491b2f2fa3120c6a (diff)
qw@1.0.1
-rw-r--r--node_modules/qw/LICENSE14
-rw-r--r--node_modules/qw/README.md35
-rw-r--r--node_modules/qw/package.json60
-rw-r--r--node_modules/qw/qw.js43
-rw-r--r--package-lock.json5
-rw-r--r--package.json2
6 files changed, 159 insertions, 0 deletions
diff --git a/node_modules/qw/LICENSE b/node_modules/qw/LICENSE
new file mode 100644
index 000000000..51bcf57ee
--- /dev/null
+++ b/node_modules/qw/LICENSE
@@ -0,0 +1,14 @@
+Copyright (c) 2016, Rebecca Turner <me@re-becca.org>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
diff --git a/node_modules/qw/README.md b/node_modules/qw/README.md
new file mode 100644
index 000000000..e42fc66d5
--- /dev/null
+++ b/node_modules/qw/README.md
@@ -0,0 +1,35 @@
+# qw
+
+Quoted word literals!
+
+```js
+const qw = require('qw')
+
+const myword = qw` this is
+ a long list
+ of words`
+// equiv of:
+const myword = [ 'this', 'is', 'a', 'long', 'list', 'of', 'words' ]
+```
+
+You can embed vars in the usual way:
+
+```js
+const mywords = qw`product ${23 * 5} also ${'escaping a string'}`
+// equiv of:
+const mywords = [ 'product', 23 * 5, 'also', 'escaping a string' ]
+```
+
+You can also embed vars inside strings:
+
+```js
+const mywords = qw`product=${23 * 5} also "${'escaping a string'}"`
+// equiv of:
+const mywords = [ 'product=' + (23 * 5), 'also', '"escaping a string"' ]
+```
+
+## DESCRIPTION
+
+This uses template strings to bring over this little common convenience from
+Perl-land.
+
diff --git a/node_modules/qw/package.json b/node_modules/qw/package.json
new file mode 100644
index 000000000..fb4c272f3
--- /dev/null
+++ b/node_modules/qw/package.json
@@ -0,0 +1,60 @@
+{
+ "_from": "qw",
+ "_id": "qw@1.0.1",
+ "_inBundle": false,
+ "_integrity": "sha1-77/cdA+a0FQwRCassYNBLMi5ltQ=",
+ "_location": "/qw",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "tag",
+ "registry": true,
+ "raw": "qw",
+ "name": "qw",
+ "escapedName": "qw",
+ "rawSpec": "",
+ "saveSpec": null,
+ "fetchSpec": "latest"
+ },
+ "_requiredBy": [
+ "#USER",
+ "/"
+ ],
+ "_resolved": "https://registry.npmjs.org/qw/-/qw-1.0.1.tgz",
+ "_shasum": "efbfdc740f9ad054304426acb183412cc8b996d4",
+ "_spec": "qw",
+ "_where": "/Users/rebecca/code/npm",
+ "author": {
+ "name": "Rebecca Turner",
+ "email": "me@re-becca.org",
+ "url": "http://re-becca.org/"
+ },
+ "bugs": {
+ "url": "https://github.com/iarna/node-qw/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {},
+ "deprecated": false,
+ "description": "Quoted word literals!",
+ "devDependencies": {
+ "tap": "^8.0.0"
+ },
+ "directories": {
+ "test": "test"
+ },
+ "files": [
+ "qw.js"
+ ],
+ "homepage": "https://github.com/iarna/node-qw#readme",
+ "keywords": [],
+ "license": "ISC",
+ "main": "qw.js",
+ "name": "qw",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/iarna/node-qw.git"
+ },
+ "scripts": {
+ "test": "tap test"
+ },
+ "version": "1.0.1"
+}
diff --git a/node_modules/qw/qw.js b/node_modules/qw/qw.js
new file mode 100644
index 000000000..239e5a565
--- /dev/null
+++ b/node_modules/qw/qw.js
@@ -0,0 +1,43 @@
+'use strict'
+module.exports = qw
+
+function appendLast (arr, str) {
+ var last = arr.length - 1
+ if (last < 0) {
+ arr.push(str)
+ } else {
+ var lastValue = String(arr[last])
+ return arr[last] = lastValue + String(str)
+ }
+}
+
+function qw () {
+ const args = Object.assign([], arguments[0])
+ const values = [].slice.call(arguments, 1)
+ const words = []
+ let lastWordWasValue = false
+ while (args.length) {
+ const arg = args.shift()
+ const concatValue = arg.length === 0 || arg.slice(-1) !== ' '
+ if (arg.trim() !== '') {
+ const theseWords = arg.replace(/^\s+|\s+$/g, '').replace(/\s+/g, ' ').split(/ /)
+ if (lastWordWasValue && arg[0] !== ' ') {
+ appendLast(words, theseWords.shift())
+ }
+ words.push.apply(words, theseWords)
+ }
+
+ if (values.length) {
+ const val = values.shift()
+ if (concatValue) {
+ appendLast(words, val)
+ } else {
+ words.push(val)
+ }
+ lastWordWasValue = true
+ } else {
+ lastWordWasValue = false
+ }
+ }
+ return words
+}
diff --git a/package-lock.json b/package-lock.json
index 01f703cb7..1d17522a9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2925,6 +2925,11 @@
"resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz",
"integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM="
},
+ "qw": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/qw/-/qw-1.0.1.tgz",
+ "integrity": "sha1-77/cdA+a0FQwRCassYNBLMi5ltQ="
+ },
"read": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz",
diff --git a/package.json b/package.json
index 59060789e..d3ab7bdad 100644
--- a/package.json
+++ b/package.json
@@ -92,6 +92,7 @@
"pacote": "~6.0.2",
"path-is-inside": "~1.0.2",
"promise-inflight": "~1.0.1",
+ "qw": "~1.0.1",
"read": "~1.0.7",
"read-cmd-shim": "~1.0.1",
"read-installed": "~4.0.3",
@@ -191,6 +192,7 @@
"pacote",
"path-is-inside",
"promise-inflight",
+ "qw",
"read",
"read-cmd-shim",
"read-installed",