Socket
Socket
Sign inDemoInstall

@node-red/util

Package Overview
Dependencies
Maintainers
2
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@node-red/util - npm Package Compare versions

Comparing version 2.0.6 to 2.1.0-beta.1

5

lib/i18n.js

@@ -26,3 +26,3 @@ /**

var path = require("path");
var fs = require("fs-extra");
var fs = require("fs");

@@ -93,3 +93,3 @@ var defaultLang = "en-US";

const file = path.join(resourceMap[ns].basedir, lng, resourceMap[ns].file);
const content = await fs.readFile(file, "utf8");
const content = await fs.promises.readFile(file, "utf8");
resourceCache[ns] = resourceCache[ns] || {};

@@ -146,2 +146,3 @@ resourceCache[ns][lng] = JSON.parse(content.replace(/^\uFEFF/, ''));

var opt = {
compatibilityJSON: 'v3',
// debug: true,

@@ -148,0 +149,0 @@ defaultNS: "runtime",

27

lib/util.js

@@ -524,8 +524,13 @@ /**

*/
function getSetting(node, name) {
if (node && node._flow) {
var flow = node._flow;
if (flow) {
return flow.getSetting(name);
function getSetting(node, name, flow_) {
var flow = (flow_ ? flow_ : (node ? node._flow : null));
if (flow) {
if (node && node.g) {
const group = flow.getGroupNode(node.g);
const result = flow.getGroupEnvSetting(node, group, name);
if (result) {
return result.val;
}
}
return flow.getSetting(name);
}

@@ -548,2 +553,3 @@ return process.env[name];

function evaluateEnvProperty(value, node) {
var flow = (node && node.hasOwnProperty("_flow")) ? node._flow : null;
var result;

@@ -553,10 +559,10 @@ if (/^\${[^}]+}$/.test(value)) {

var name = value.substring(2,value.length-1);
result = getSetting(node, name);
result = getSetting(node, name, flow);
} else if (!/\${\S+}/.test(value)) {
// ENV_VAR
result = getSetting(node, value);
result = getSetting(node, value, flow);
} else {
// FOO${ENV_VAR}BAR
return value.replace(/\${([^}]+)}/g, function(match, name) {
var val = getSetting(node, name);
var val = getSetting(node, name, flow);
return (val === undefined)?"":val;

@@ -674,3 +680,3 @@ });

expr.assign('env', function(name) {
var val = getSetting(node, name);
var val = getSetting(node, name, node._flow);
if (typeof val !== 'undefined') {

@@ -983,3 +989,4 @@ return val;

evaluateJSONataExpression: evaluateJSONataExpression,
parseContextStore: parseContextStore
parseContextStore: parseContextStore,
getSetting: getSetting
};
{
"name": "@node-red/util",
"version": "2.0.6",
"version": "2.1.0-beta.1",
"license": "Apache-2.0",

@@ -19,3 +19,3 @@ "repository": {

"fs-extra": "10.0.0",
"i18next": "20.3.2",
"i18next": "21.2.4",
"json-stringify-safe": "5.0.1",

@@ -22,0 +22,0 @@ "jsonata": "1.8.5",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc