node-red-viseo-helper
Advanced tools
Comparing version 0.1.26 to 0.1.27
@@ -0,0 +0,0 @@ # Contributor Covenant Code of Conduct |
@@ -0,0 +0,0 @@ # Contributing to the Project |
30
index.js
@@ -150,2 +150,32 @@ 'use strict'; | ||
const setContextByString = exports.setContextByString = (RED, node, str, value, env) => { | ||
if (!env) env = 'global'; | ||
else if (env !== 'global' && env !== 'flow') error('env must be "flow" or "global"'); | ||
try { | ||
let contextKey = RED.util.parseContextStore(str); | ||
let target = node.context()[env]; | ||
return target.set(contextKey.key, value, contextKey.store, null); | ||
} | ||
catch(err) { | ||
error(err); | ||
return null; | ||
} | ||
} | ||
const getContextByString = exports.getContextByString = (RED, node, str, env) => { | ||
if (!env) env = 'global'; | ||
else if (env !== 'global' && env !== 'flow') error('env must be "flow" or "global"'); | ||
try { | ||
let contextKey = RED.util.parseContextStore(str); | ||
let target = node.context()[env] | ||
return target.get(contextKey.key, contextKey.store, null); | ||
} | ||
catch(err) { | ||
error(err); | ||
return null; | ||
} | ||
} | ||
// ------------------------------------------ | ||
@@ -152,0 +182,0 @@ // EVENT |
@@ -0,0 +0,0 @@ const extend = require('extend'); |
{ | ||
"name" : "node-red-viseo-helper", | ||
"version" : "0.1.26", | ||
"version" : "0.1.27", | ||
"description" : "Utility libarary for Node-RED", | ||
@@ -5,0 +5,0 @@ "dependencies" : { |
@@ -0,0 +0,0 @@ # Node-RED |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24524
201