How to use the @node-red/util.util.getObjectProperty function in @node-red/util

To help you get started, we’ve selected a few @node-red/util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / context / index.js View on Github external
return
                            }
                            // Put the err arg back
                            results.unshift(undefined);
                            callback.apply(null,results);
                        });
                    }
                } else {
                    // No callback, attempt to do this synchronously
                    var results = context.get(scope,key);
                    if (seed) {
                        if (Array.isArray(key)) {
                            insertSeedValues(key,results);
                        } else if (results === undefined){
                            try {
                                results = util.getObjectProperty(seed,key);
                            } catch(err) {
                                if (err.code === "INVALID_EXPR") {
                                    throw err;
                                }
                                results = undefined;
                            }
                        }
                    }
                    return results;
                }
            }
        },
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / context / localfilesystem.js View on Github external
data = JSON.parse(data);
            if (!Array.isArray(key)) {
                try {
                    value = util.getObjectProperty(data,key);
                } catch(err) {
                    if (err.code === "INVALID_EXPR") {
                        throw err;
                    }
                    value = undefined;
                }
                callback(null, value);
            } else {
                var results = [undefined];
                for (var i=0;i
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / context / localfilesystem.js View on Github external
loadFile(storagePath + ".json").then(function(data){
        var value;
        if(data){
            data = JSON.parse(data);
            if (!Array.isArray(key)) {
                try {
                    value = util.getObjectProperty(data,key);
                } catch(err) {
                    if (err.code === "INVALID_EXPR") {
                        throw err;
                    }
                    value = undefined;
                }
                callback(null, value);
            } else {
                var results = [undefined];
                for (var i=0;i
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / context / memory.js View on Github external
Memory.prototype._getOne = function(scope, key) {
    var value;
    var error;
    if(this.data[scope]){
        try {
            value = util.getObjectProperty(this.data[scope], key);
        } catch(err) {
            if (err.code === "INVALID_EXPR") {
                throw err;
            }
            value = undefined;
        }
    }
    return value;
}
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / context / index.js View on Github external
if (!Array.isArray(keys)) {
                if (values[0] === undefined) {
                    try {
                        values[0] = util.getObjectProperty(seed,keys);
                    } catch(err) {
                        if (err.code === "INVALID_EXPR") {
                            throw err;
                        }
                        values[0] = undefined;
                    }
                }
            } else {
                for (var i=0;i
github node-red / node-red / packages / node_modules / @node-red / runtime / lib / nodes / context / index.js View on Github external
insertSeedValues = function(keys,values) {
            if (!Array.isArray(keys)) {
                if (values[0] === undefined) {
                    try {
                        values[0] = util.getObjectProperty(seed,keys);
                    } catch(err) {
                        if (err.code === "INVALID_EXPR") {
                            throw err;
                        }
                        values[0] = undefined;
                    }
                }
            } else {
                for (var i=0;i