mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add support for moment in jsonata expressions, based on elasticio/jsonata-moment
This commit is contained in:
parent
bcf1d986a4
commit
effff3405b
@ -22,6 +22,7 @@
|
||||
|
||||
const clone = require("clone");
|
||||
const jsonata = require("jsonata");
|
||||
const moment = require("moment");
|
||||
const safeJSONStringify = require("json-stringify-safe");
|
||||
const util = require("util");
|
||||
|
||||
@ -569,9 +570,12 @@ function prepareJSONataExpression(value,node) {
|
||||
if (typeof val !== 'undefined') {
|
||||
return val;
|
||||
} else {
|
||||
return ""
|
||||
return "";
|
||||
}
|
||||
})
|
||||
});
|
||||
expr.assign('moment', function(arg1, arg2, arg3, arg4) {
|
||||
return moment(arg1, arg2, arg3, arg4);
|
||||
});
|
||||
expr.registerFunction('clone', cloneMessage, '<(oa)-:o>');
|
||||
expr._legacyMode = /(^|[^a-zA-Z0-9_'"])msg([^a-zA-Z0-9_'"]|$)/.test(value);
|
||||
expr._node = node;
|
||||
|
Loading…
Reference in New Issue
Block a user