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:
-rwxr-xr-xnode_modules/JSONStream/index.js11
-rw-r--r--node_modules/JSONStream/package.json46
-rw-r--r--node_modules/JSONStream/readme.markdown12
-rw-r--r--node_modules/JSONStream/test/keys.js20
-rw-r--r--npm-shrinkwrap.json6
-rw-r--r--package.json2
6 files changed, 69 insertions, 28 deletions
diff --git a/node_modules/JSONStream/index.js b/node_modules/JSONStream/index.js
index 5546d4687..c164100d9 100755
--- a/node_modules/JSONStream/index.js
+++ b/node_modules/JSONStream/index.js
@@ -58,6 +58,7 @@ exports.parse = function (path, map) {
var i = 0 // iterates on path
var j = 0 // iterates on stack
var emitKey = false;
+ var emitPath = false;
while (i < path.length) {
var key = path[i]
var c
@@ -71,6 +72,7 @@ exports.parse = function (path, map) {
return
}
emitKey = !!key.emitKey;
+ emitPath = !!key.emitPath;
i++
} else {
i++
@@ -99,7 +101,14 @@ exports.parse = function (path, map) {
var data = this.value[this.key]
if(null != data)
if(null != (data = map ? map(data, actualPath) : data)) {
- data = emitKey ? { value: data, key: this.key } : data;
+ if (emitKey || emitPath) {
+ data = { value: data };
+ if (emitKey)
+ data["key"] = this.key;
+ if (emitPath)
+ data["path"] = actualPath;
+ }
+
stream.queue(data)
}
delete this.value[this.key]
diff --git a/node_modules/JSONStream/package.json b/node_modules/JSONStream/package.json
index c86c7113e..75eacb3b0 100644
--- a/node_modules/JSONStream/package.json
+++ b/node_modules/JSONStream/package.json
@@ -2,50 +2,50 @@
"_args": [
[
{
- "raw": "JSONStream",
+ "raw": "JSONStream@1.3.0",
"scope": null,
"escapedName": "JSONStream",
"name": "JSONStream",
- "rawSpec": "",
- "spec": "latest",
- "type": "tag"
+ "rawSpec": "1.3.0",
+ "spec": "1.3.0",
+ "type": "version"
},
- "/Users/zkat/Documents/code/npm"
+ "/Users/rebecca/code/npm"
]
],
- "_from": "JSONStream@latest",
- "_id": "JSONStream@1.2.1",
+ "_from": "JSONStream@1.3.0",
+ "_id": "JSONStream@1.3.0",
"_inCache": true,
"_location": "/JSONStream",
- "_nodeVersion": "6.4.0",
+ "_nodeVersion": "6.5.0",
"_npmOperationalInternal": {
- "host": "packages-16-east.internal.npmjs.com",
- "tmp": "tmp/JSONStream-1.2.1.tgz_1474751953169_0.9057570598088205"
+ "host": "packages-18-east.internal.npmjs.com",
+ "tmp": "tmp/JSONStream-1.3.0.tgz_1481845260408_0.7681232686154544"
},
"_npmUser": {
"name": "dominictarr",
"email": "dominic.tarr@gmail.com"
},
- "_npmVersion": "3.9.3",
+ "_npmVersion": "3.10.3",
"_phantomChildren": {},
"_requested": {
- "raw": "JSONStream",
+ "raw": "JSONStream@1.3.0",
"scope": null,
"escapedName": "JSONStream",
"name": "JSONStream",
- "rawSpec": "",
- "spec": "latest",
- "type": "tag"
+ "rawSpec": "1.3.0",
+ "spec": "1.3.0",
+ "type": "version"
},
"_requiredBy": [
"#USER",
"/"
],
- "_resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.2.1.tgz",
- "_shasum": "32aa5790e799481083b49b4b7fa94e23bae69bf9",
+ "_resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.0.tgz",
+ "_shasum": "680ab9ac6572a8a1a207e0b38721db1c77b215e5",
"_shrinkwrap": null,
- "_spec": "JSONStream",
- "_where": "/Users/zkat/Documents/code/npm",
+ "_spec": "JSONStream@1.3.0",
+ "_where": "/Users/rebecca/code/npm",
"author": {
"name": "Dominic Tarr",
"email": "dominic.tarr@gmail.com",
@@ -72,13 +72,13 @@
},
"directories": {},
"dist": {
- "shasum": "32aa5790e799481083b49b4b7fa94e23bae69bf9",
- "tarball": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.2.1.tgz"
+ "shasum": "680ab9ac6572a8a1a207e0b38721db1c77b215e5",
+ "tarball": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.0.tgz"
},
"engines": {
"node": "*"
},
- "gitHead": "641402b48dbf3db5380e9bc857753c237d4ee9d9",
+ "gitHead": "3d5d3283d79e23da81fa6fc4b76bc1f44ff0047d",
"homepage": "http://github.com/dominictarr/JSONStream",
"keywords": [
"json",
@@ -109,5 +109,5 @@
"scripts": {
"test": "set -e; for t in test/*.js; do echo '***' $t '***'; node $t; done"
},
- "version": "1.2.1"
+ "version": "1.3.0"
}
diff --git a/node_modules/JSONStream/readme.markdown b/node_modules/JSONStream/readme.markdown
index 3d3fc239b..422c3df2c 100644
--- a/node_modules/JSONStream/readme.markdown
+++ b/node_modules/JSONStream/readme.markdown
@@ -104,6 +104,18 @@ stream.on('data', function(data) {
```
+You can also emit the path:
+
+``` js
+var stream = JSONStream.parse(['rows', true, 'doc', {emitPath: true}]) //rows, ANYTHING, doc, items in docs with keys
+
+stream.on('data', function(data) {
+ console.log('path:', data.path);
+ console.log('value:', data.value);
+});
+
+```
+
### recursive patterns (..)
`JSONStream.parse('docs..value')`
diff --git a/node_modules/JSONStream/test/keys.js b/node_modules/JSONStream/test/keys.js
index c60088afa..86b65b257 100644
--- a/node_modules/JSONStream/test/keys.js
+++ b/node_modules/JSONStream/test/keys.js
@@ -39,6 +39,26 @@ test('keys via array', function(t) {
assertFixtureKeys(stream, t);
});
+test('path via array', function(t) {
+ var stream = JSONStream.parse(['obj',{emitPath: true}]);
+
+ var paths = [];
+ var values = [];
+ stream.on('data', function(data) {
+ console.log(JSON.stringify(data));
+ paths.push(data.path);
+ values.push(data.value);
+ });
+
+ stream.on('end', function() {
+ t.deepEqual(paths, [['obj', 'one'], ['obj', 'two'], ['obj', 'three']]);
+ t.deepEqual(values, [1,2,3]);
+ t.end();
+ });
+ stream.write(JSON.stringify(fixture));
+ stream.end();
+});
+
test('advanced keys', function(t) {
var advanced = fs.readFileSync(couch_sample_file);
var stream = JSONStream.parse(['rows', true, 'doc', {emitKey: true}]);
diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json
index 6e0d31e9b..eef7d173d 100644
--- a/npm-shrinkwrap.json
+++ b/npm-shrinkwrap.json
@@ -285,9 +285,9 @@
}
},
"JSONStream": {
- "version": "1.2.1",
- "from": "JSONStream@latest",
- "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.2.1.tgz",
+ "version": "1.3.0",
+ "from": "JSONStream@1.3.0",
+ "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.0.tgz",
"dependencies": {
"jsonparse": {
"version": "1.2.0",
diff --git a/package.json b/package.json
index e0889dadc..3154db516 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
"main": "./lib/npm.js",
"bin": "./bin/npm-cli.js",
"dependencies": {
- "JSONStream": "~1.2.1",
+ "JSONStream": "~1.3.0",
"abbrev": "~1.0.9",
"ansicolors": "~0.3.2",
"ansistyles": "~0.1.3",