New Upstream Release - node-jmespath
Ready changes
Summary
Merged new upstream version: 0.16.0+dfsg (was: 0.15.0+dfsg).
Resulting package
Built on 2022-11-23T13:35 (took 2m30s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases node-jmespath
Lintian Result
Diff
diff --git a/.gitignore b/.gitignore
index 3c3629e..eeaf59e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
node_modules
+/yarn.lock
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..d532157
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,6 @@
+test/
+*.*
+!*.js
+!*.json
+perf.js
+Gruntfile.js
diff --git a/debian/changelog b/debian/changelog
index 1c31b12..004a6dd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+node-jmespath (0.16.0+dfsg-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk> Wed, 23 Nov 2022 13:34:01 -0000
+
node-jmespath (0.15.0+dfsg-4) unstable; urgency=medium
[ Debian Janitor ]
diff --git a/jmespath.js b/jmespath.js
index f59e8e4..0a36691 100644
--- a/jmespath.js
+++ b/jmespath.js
@@ -140,6 +140,18 @@
var TYPE_NULL = 7;
var TYPE_ARRAY_NUMBER = 8;
var TYPE_ARRAY_STRING = 9;
+ var TYPE_NAME_TABLE = {
+ 0: 'number',
+ 1: 'any',
+ 2: 'string',
+ 3: 'array',
+ 4: 'object',
+ 5: 'boolean',
+ 6: 'expression',
+ 7: 'null',
+ 8: 'Array<number>',
+ 9: 'Array<string>'
+ };
var TOK_EOF = "EOF";
var TOK_UNQUOTEDIDENTIFIER = "UnquotedIdentifier";
@@ -551,10 +563,8 @@
var node = {type: "Field", name: token.value};
if (this._lookahead(0) === TOK_LPAREN) {
throw new Error("Quoted identifier not allowed for function names.");
- } else {
- return node;
}
- break;
+ return node;
case TOK_NOT:
right = this.expression(bindingPower.Not);
return {type: "NotExpression", children: [right]};
@@ -588,10 +598,8 @@
right = this._parseProjectionRHS(bindingPower.Star);
return {type: "Projection",
children: [{type: "Identity"}, right]};
- } else {
- return this._parseMultiselectList();
}
- break;
+ return this._parseMultiselectList();
case TOK_CURRENT:
return {type: TOK_CURRENT};
case TOK_EXPREF:
@@ -623,13 +631,11 @@
if (this._lookahead(0) !== TOK_STAR) {
right = this._parseDotRHS(rbp);
return {type: "Subexpression", children: [left, right]};
- } else {
- // Creating a projection.
- this._advance();
- right = this._parseProjectionRHS(rbp);
- return {type: "ValueProjection", children: [left, right]};
}
- break;
+ // Creating a projection.
+ this._advance();
+ right = this._parseProjectionRHS(rbp);
+ return {type: "ValueProjection", children: [left, right]};
case TOK_PIPE:
right = this.expression(bindingPower.Pipe);
return {type: TOK_PIPE, children: [left, right]};
@@ -683,13 +689,11 @@
if (token.type === TOK_NUMBER || token.type === TOK_COLON) {
right = this._parseIndexExpression();
return this._projectIfSlice(left, right);
- } else {
- this._match(TOK_STAR);
- this._match(TOK_RBRACKET);
- right = this._parseProjectionRHS(bindingPower.Star);
- return {type: "Projection", children: [left, right]};
}
- break;
+ this._match(TOK_STAR);
+ this._match(TOK_RBRACKET);
+ right = this._parseProjectionRHS(bindingPower.Star);
+ return {type: "Projection", children: [left, right]};
default:
this._errorToken(this._lookaheadToken(0));
}
@@ -866,19 +870,15 @@
var matched, current, result, first, second, field, left, right, collected, i;
switch (node.type) {
case "Field":
- if (value === null ) {
- return null;
- } else if (isObject(value)) {
+ if (value !== null && isObject(value)) {
field = value[node.name];
if (field === undefined) {
return null;
} else {
return field;
}
- } else {
- return null;
}
- break;
+ return null;
case "Subexpression":
result = this.visit(node.children[0], value);
for (i = 1; i < node.children.length; i++) {
@@ -1249,11 +1249,16 @@
}
}
if (!typeMatched) {
+ var expected = currentSpec
+ .map(function(typeIdentifier) {
+ return TYPE_NAME_TABLE[typeIdentifier];
+ })
+ .join(',');
throw new Error("TypeError: " + name + "() " +
"expected argument " + (i + 1) +
- " to be type " + currentSpec +
- " but received type " + actualType +
- " instead.");
+ " to be type " + expected +
+ " but received type " +
+ TYPE_NAME_TABLE[actualType] + " instead.");
}
}
},
diff --git a/package.json b/package.json
index d6575d7..8c1d27c 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "jmespath",
"description": "JMESPath implementation in javascript",
- "version": "0.15.0",
+ "version": "0.16.0",
"author": {
"name": "James Saryerwinnie",
"email": "js@jamesls.com",
@@ -32,12 +32,7 @@
"url": "http://github.com/jmespath/jmespath.js/issues",
"mail": ""
},
- "licenses": [
- {
- "type": "Apache 2.0",
- "url": "http://github.com/jmespath/jmespath.js/raw/master/LICENSE"
- }
- ],
+ "license": "Apache-2.0",
"keywords": [
"jmespath",
"jsonpath",
diff --git a/test/jmespath.js b/test/jmespath.js
index 15f61c1..98d4ead 100644
--- a/test/jmespath.js
+++ b/test/jmespath.js
@@ -160,6 +160,7 @@ describe('tokenize', function() {
]
);
});
+
});
@@ -215,3 +216,19 @@ describe('strictDeepEqual', function() {
{a: {b: [1, 4]}}), false);
});
});
+
+describe('search', function() {
+ it(
+ 'should throw a readable error when invalid arguments are provided to a function',
+ function() {
+ try {
+ jmespath.search([], 'length(`null`)');
+ } catch (e) {
+ assert(e.message.search(
+ 'expected argument 1 to be type string,array,object'
+ ), e.message);
+ assert(e.message.search('received type null'), e.message);
+ }
+ }
+ );
+});
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/share/nodejs/jmespath/perf.js
No differences were encountered in the control files