Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/node-red/node_modules/getobject/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type: /*
* getobject
* https://github.com/cowboy/node-getobject
*
* Copyright (c) 2013 "Cowboy" Ben Alman
* Licensed under the MIT license.
*/
'use strict';
var getobject = module.exports = {};
// Split strings on dot, but only if dot isn't preceded by a backslash. Since
// JavaScript doesn't support lookbehinds, use a placeholder for "\.", split
// on dot, then replace the placeholder character with a dot.
function getParts(str) {
return str.replace(/\\\./g, '\uffff').split('.').map(function(s) {
return s.replace(/\uffff/g, '.');
});
}
// Get the value of a deeply-nested property exist in an object.
getobject.get = function(obj, parts, create) {
if (typeof parts === 'string') {
parts = getParts(parts);
}
var part;
while (typeof obj === 'object' && obj && parts.length) {
part = parts.shift();
if (!(part in obj) && create) {
obj[part] = {};
}
obj = obj[part];
}
return obj;
};
// Set a deeply-nested property in an object, creating intermediary objects
// as we go.
getobject.set = function(obj, parts, value) {
parts = getParts(parts);
if (parts.includes('__proto__')) {
// do not allow setting of __proto__. See CVE-2020-28282.
return;
}
var prop = parts.pop();
obj = getobject.get(obj, parts, true);
if (obj && typeof obj === 'object') {
return (obj[prop] = value);
}
};
// Does a deeply-nested property exist in an object?
getobject.exists = function(obj, parts) {
parts = getParts(parts);
var prop = parts.pop();
obj = getobject.get(obj, parts);
return typeof obj === 'object' && obj && prop in obj;
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0044 ]-- |