Update jsonata to 1.4.1

This commit is contained in:
Nick O'Leary 2018-01-13 20:42:23 +00:00
parent 8c42b2bdb4
commit fd9e3fc03a
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
4 changed files with 30 additions and 1 deletions

View File

@ -120,6 +120,11 @@
'$exists':{ args:[ 'arg' ]},
'$filter':{ args:[ 'array', 'function' ]},
'$floor':{ args:[ 'number' ]},
'$flowContext': {args:['string']},
'$formatBase': {args:['number','radix']},
'$formatNumber': {args:['number', 'picture', 'options']},
'$fromMillis': {args:['number']},
'$globalContext': {args:['string']},
'$join':{ args:[ 'array', 'separator' ]},
'$keys':{ args:[ 'object' ]},
'$length':{ args:[ 'str' ]},
@ -134,6 +139,7 @@
'$not':{ args:[ 'arg' ]},
'$now':{ args:[ ]},
'$number':{ args:[ 'arg' ]},
'$pad': {args:['str', 'width','char']},
'$power':{ args:[ 'base', 'exponent' ]},
'$random':{ args:[ ]},
'$reduce':{ args:[ 'array', 'function' , 'init' ]},
@ -151,6 +157,7 @@
'$substringAfter':{ args:[ 'str', 'chars' ]},
'$substringBefore':{ args:[ 'str', 'chars' ]},
'$sum':{ args:[ 'array' ]},
'$toMillis':{args:['timestamp']}, // <-------------
'$trim':{ args:[ 'str' ]},
'$uppercase':{ args:[ 'str' ]},
'$zip':{ args:[ 'array1' ]}

View File

@ -52,7 +52,7 @@
"is-utf8": "0.2.1",
"js-yaml": "3.8.4",
"json-stringify-safe": "5.0.1",
"jsonata": "1.3.0",
"jsonata": "1.4.1",
"media-typer": "0.3.0",
"memorystore": "1.6.0",
"mqtt": "2.9.0",

View File

@ -195,5 +195,26 @@
"$globalContext": {
"args": "string",
"desc": "Retrieves a global context property."
},
"$pad": {
"args": "string, width [, char]",
"desc": "Returns a copy of the `string` with extra padding, if necessary, so that its total number of characters is at least the absolute value of the `width` parameter.\n\nIf `width` is a positive number, then the string is padded to the right; if negative, it is padded to the left.\n\nThe optional `char` argument specifies the padding character(s) to use. If not specified, it defaults to the space character."
},
"$fromMillis": {
"args": "number",
"desc": "Convert a number representing milliseconds since the Unix Epoch (1 January, 1970 UTC) to a timestamp string in the ISO 8601 format."
},
"$formatNumber": {
"args": "number, picture [, options]",
"desc": "Casts the number to a string and formats it to a decimal representation as specified by the picture string.\n\n The behaviour of this function is consistent with the XPath/XQuery function fn:format-number as defined in the XPath F&O 3.1 specification. The picture string parameter defines how the number is formatted and has the same syntax as fn:format-number.\n\nThe optional third argument options is used to override the default locale specific formatting characters such as the decimal separator. If supplied, this argument must be an object containing name/value pairs specified in the decimal format section of the XPath F&O 3.1 specification."
},
"$formatBase": {
"args": "number [, radix]",
"desc": "Casts the number to a string and formats it to an integer represented in the number base specified by the radix argument. If radix is not specified, then it defaults to base 10. radix can be between 2 and 36, otherwise an error is thrown."
},
"$toMillis": {
"args": "timestamp",
"desc": "Convert a timestamp string in the ISO 8601 format to the number of milliseconds since the Unix Epoch (1 January, 1970 UTC) as a number. An error is thrown if the string is not in the correct format."
}
}

View File

@ -340,6 +340,7 @@ function prepareJSONataExpression(value,node) {
expr.assign('globalContext',function(val) {
return node.context().global.get(val);
});
expr.registerFunction('clone', cloneMessage, '<(oa)-:o>');
expr._legacyMode = /(^|[^a-zA-Z0-9_'"])msg([^a-zA-Z0-9_'"]|$)/.test(value);
return expr;
}