@node-red/util 2.1.0 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/i18n.js CHANGED
@@ -136,8 +136,6 @@ function getCurrentLocale() {
136
136
 
137
137
  function init(settings) {
138
138
  if (!initPromise) {
139
- // Keep this as a 'when' promise as top-level red.js uses 'otherwise'
140
- // and embedded users of NR may have copied that.
141
139
  initPromise = new Promise((resolve,reject) => {
142
140
  i18n.use(MessageFileLoader);
143
141
  var opt = {
@@ -146,6 +144,8 @@ function init(settings) {
146
144
  defaultNS: "runtime",
147
145
  ns: [],
148
146
  fallbackLng: defaultLang,
147
+ keySeparator: ".",
148
+ nsSeparator: ":",
149
149
  interpolation: {
150
150
  unescapeSuffix: 'HTML',
151
151
  escapeValue: false,
package/lib/util.js CHANGED
@@ -526,10 +526,11 @@ function getSetting(node, name, flow_) {
526
526
  if (flow) {
527
527
  if (node && node.g) {
528
528
  const group = flow.getGroupNode(node.g);
529
- const result = flow.getGroupEnvSetting(node, group, name);
529
+ const [result, newName] = flow.getGroupEnvSetting(node, group, name);
530
530
  if (result) {
531
531
  return result.val;
532
532
  }
533
+ name = newName;
533
534
  }
534
535
  return flow.getSetting(name);
535
536
  }
@@ -842,6 +843,9 @@ function encodeObject(msg,opts) {
842
843
  length: msg.msg.size
843
844
  }
844
845
  needsStringify = true;
846
+ } else if (msg.msg && msg.msg.constructor.name === "RegExp") {
847
+ msg.format = 'regexp';
848
+ msg.msg = msg.msg.toString();
845
849
  }
846
850
  if (needsStringify || (msg.format === "Object")) {
847
851
  msg.msg = safeJSONStringify(msg.msg, function(key, value) {
@@ -907,6 +911,12 @@ function encodeObject(msg,opts) {
907
911
  data: Object.fromEntries(Array.from(value.entries()).slice(0,debuglength)),
908
912
  length: value.size
909
913
  }
914
+ } else if (value.constructor.name === "RegExp") {
915
+ value = {
916
+ __enc__: true,
917
+ type: "regexp",
918
+ data: value.toString()
919
+ }
910
920
  }
911
921
  } else if (value === undefined) {
912
922
  value = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node-red/util",
3
- "version": "2.1.0",
3
+ "version": "2.1.4",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,10 +16,10 @@
16
16
  ],
17
17
  "dependencies": {
18
18
  "fs-extra": "10.0.0",
19
- "i18next": "21.3.1",
19
+ "i18next": "21.5.4",
20
20
  "json-stringify-safe": "5.0.1",
21
21
  "jsonata": "1.8.5",
22
22
  "lodash.clonedeep": "^4.5.0",
23
- "moment-timezone": "0.5.33"
23
+ "moment-timezone": "0.5.34"
24
24
  }
25
25
  }