summaryrefslogtreecommitdiff
path: root/tools/eslint/node_modules/jsonpointer
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-02-15 14:45:53 -0800
committerRich Trott <rtrott@gmail.com>2016-02-18 10:13:13 -0800
commitd7aa8fa088f3b8a31c7d85c6d71824c8c60e7c17 (patch)
tree739f4a86de562584f10eba7f1a06a406d8d66366 /tools/eslint/node_modules/jsonpointer
parentd3c3a928c3a2f9e961881b47ef0796e57ae8d429 (diff)
downloadnode-new-d7aa8fa088f3b8a31c7d85c6d71824c8c60e7c17.tar.gz
tools: update ESLint to version 2.1.0
Update ESLint to 2.1.0. ESLint has a number of potentially-useful new features but this change attempts to be minimal in its changes. However, some things could not be avoided reasonably. ESLint 2.1.0 found a few lint issues that ESLing 1.x missed with template strings that did not take advantage of any features of template strings, and `let` declarations where `const` sufficed. Additionally, ESLint 2.1.0 removes some granularity around enabling ES6 features. Some features (e.g., spread operator) that had been turned off in our configuration for ESLint 1.x are now permitted. PR-URL: https://github.com/nodejs/node/pull/5214 Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: jbergstroem - Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'tools/eslint/node_modules/jsonpointer')
-rw-r--r--tools/eslint/node_modules/jsonpointer/.travis.yml10
-rw-r--r--tools/eslint/node_modules/jsonpointer/package.json18
-rw-r--r--tools/eslint/node_modules/jsonpointer/test.js98
3 files changed, 117 insertions, 9 deletions
diff --git a/tools/eslint/node_modules/jsonpointer/.travis.yml b/tools/eslint/node_modules/jsonpointer/.travis.yml
new file mode 100644
index 0000000000..9338bf1470
--- /dev/null
+++ b/tools/eslint/node_modules/jsonpointer/.travis.yml
@@ -0,0 +1,10 @@
+language: "node_js"
+node_js:
+ - 0.6
+ - 0.8
+ - 0.10
+ - 0.11
+ - 0.12
+ - iojs-v1.0
+ - iojs-v2.0
+ - iojs
diff --git a/tools/eslint/node_modules/jsonpointer/package.json b/tools/eslint/node_modules/jsonpointer/package.json
index 6f4e9d6719..05d6424e2a 100644
--- a/tools/eslint/node_modules/jsonpointer/package.json
+++ b/tools/eslint/node_modules/jsonpointer/package.json
@@ -2,7 +2,7 @@
"_args": [
[
"jsonpointer@2.0.0",
- "/Users/mzasso/git/forks/node/node_modules/eslint/node_modules/is-my-json-valid"
+ "/Users/trott/test/node_modules/eslint/node_modules/is-my-json-valid"
]
],
"_from": "jsonpointer@2.0.0",
@@ -32,7 +32,7 @@
"_shasum": "3af1dd20fe85463910d469a385e33017d2a030d9",
"_shrinkwrap": null,
"_spec": "jsonpointer@2.0.0",
- "_where": "/Users/mzasso/git/forks/node/node_modules/eslint/node_modules/is-my-json-valid",
+ "_where": "/Users/trott/test/node_modules/eslint/node_modules/is-my-json-valid",
"author": {
"email": "jan@apache.org",
"name": "Jan Lehnardt"
@@ -42,8 +42,8 @@
},
"contributors": [
{
- "name": "Joe Hildebrand",
- "email": "joe-github@cursive.net"
+ "email": "joe-github@cursive.net",
+ "name": "Joe Hildebrand"
}
],
"dependencies": {},
@@ -63,12 +63,12 @@
"main": "./jsonpointer",
"maintainers": [
{
- "name": "jan",
- "email": "jan@apache.org"
+ "email": "jan@apache.org",
+ "name": "jan"
},
{
- "name": "marcbachmann",
- "email": "marc.brookman@gmail.com"
+ "email": "marc.brookman@gmail.com",
+ "name": "marcbachmann"
}
],
"name": "jsonpointer",
@@ -82,8 +82,8 @@
"test": "node test.js"
},
"tags": [
- "simple",
"util",
+ "simple",
"util",
"utility"
],
diff --git a/tools/eslint/node_modules/jsonpointer/test.js b/tools/eslint/node_modules/jsonpointer/test.js
new file mode 100644
index 0000000000..1c67d7f7ef
--- /dev/null
+++ b/tools/eslint/node_modules/jsonpointer/test.js
@@ -0,0 +1,98 @@
+var assert = require("assert");
+var jsonpointer = require("./jsonpointer");
+
+var obj = {
+ a: 1,
+ b: {
+ c: 2
+ },
+ d: {
+ e: [{a:3}, {b:4}, {c:5}]
+ }
+};
+
+assert.equal(jsonpointer.get(obj, "/a"), 1);
+assert.equal(jsonpointer.get(obj, "/b/c"), 2);
+assert.equal(jsonpointer.get(obj, "/d/e/0/a"), 3);
+assert.equal(jsonpointer.get(obj, "/d/e/1/b"), 4);
+assert.equal(jsonpointer.get(obj, "/d/e/2/c"), 5);
+
+// set returns old value
+assert.equal(jsonpointer.set(obj, "/a", 2), 1);
+assert.equal(jsonpointer.set(obj, "/b/c", 3), 2);
+assert.equal(jsonpointer.set(obj, "/d/e/0/a", 4), 3);
+assert.equal(jsonpointer.set(obj, "/d/e/1/b", 5), 4);
+assert.equal(jsonpointer.set(obj, "/d/e/2/c", 6), 5);
+
+assert.equal(jsonpointer.get(obj, "/a"), 2);
+assert.equal(jsonpointer.get(obj, "/b/c"), 3);
+assert.equal(jsonpointer.get(obj, "/d/e/0/a"), 4);
+assert.equal(jsonpointer.get(obj, "/d/e/1/b"), 5);
+assert.equal(jsonpointer.get(obj, "/d/e/2/c"), 6);
+
+assert.equal(jsonpointer.get(obj, ""), obj);
+assert.throws(function(){ jsonpointer.get(obj, "a"); }, validateError);
+assert.throws(function(){ jsonpointer.get(obj, "a/"); }, validateError);
+
+function validateError(err) {
+ if ( (err instanceof Error) && /Invalid JSON pointer/.test(err.message) ) {
+ return true;
+ }
+}
+
+var complexKeys = {
+ "a/b": {
+ c: 1
+ },
+ d: {
+ "e/f": 2
+ },
+ "~1": 3,
+ "01": 4
+}
+
+assert.equal(jsonpointer.get(complexKeys, "/a~1b/c"), 1);
+assert.equal(jsonpointer.get(complexKeys, "/d/e~1f"), 2);
+assert.equal(jsonpointer.get(complexKeys, "/~01"), 3);
+assert.equal(jsonpointer.get(complexKeys, "/01"), 4);
+assert.equal(jsonpointer.get(complexKeys, "/a/b/c"), null);
+assert.equal(jsonpointer.get(complexKeys, "/~1"), null);
+
+// draft-ietf-appsawg-json-pointer-08 has special array rules
+var ary = [ "zero", "one", "two" ];
+assert.equal(jsonpointer.get(ary, "/01"), null);
+
+//assert.equal(jsonpointer.set(ary, "/-", "three"), null);
+//assert.equal(ary[3], "three");
+
+// Examples from the draft:
+var example = {
+ "foo": ["bar", "baz"],
+ "": 0,
+ "a/b": 1,
+ "c%d": 2,
+ "e^f": 3,
+ "g|h": 4,
+ "i\\j": 5,
+ "k\"l": 6,
+ " ": 7,
+ "m~n": 8
+};
+
+assert.equal(jsonpointer.get(example, ""), example);
+var ans = jsonpointer.get(example, "/foo");
+assert.equal(ans.length, 2);
+assert.equal(ans[0], "bar");
+assert.equal(ans[1], "baz");
+assert.equal(jsonpointer.get(example, "/foo/0"), "bar");
+assert.equal(jsonpointer.get(example, "/"), 0);
+assert.equal(jsonpointer.get(example, "/a~1b"), 1);
+assert.equal(jsonpointer.get(example, "/c%d"), 2);
+assert.equal(jsonpointer.get(example, "/e^f"), 3);
+assert.equal(jsonpointer.get(example, "/g|h"), 4);
+assert.equal(jsonpointer.get(example, "/i\\j"), 5);
+assert.equal(jsonpointer.get(example, "/k\"l"), 6);
+assert.equal(jsonpointer.get(example, "/ "), 7);
+assert.equal(jsonpointer.get(example, "/m~0n"), 8);
+
+console.log("All tests pass.");