Psalm config update, add JS object deep copy function
This commit is contained in:
@@ -342,6 +342,31 @@ function valueInObject(object, value)
|
|||||||
// }) ? true : false;
|
// }) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* true deep copy for Javascript objects
|
||||||
|
* if Object.assign({}, obj) is not working (shallow)
|
||||||
|
* or if JSON.parse(JSON.stringify(obj)) is failing
|
||||||
|
* @param {Object} inObject Object to copy
|
||||||
|
* @return {Object} Copied Object
|
||||||
|
*/
|
||||||
|
function deepCopyFunction(inObject)
|
||||||
|
{
|
||||||
|
var outObject, value, key;
|
||||||
|
if (typeof inObject !== "object" || inObject === null) {
|
||||||
|
return inObject; // Return the value if inObject is not an object
|
||||||
|
}
|
||||||
|
// Create an array or object to hold the values
|
||||||
|
outObject = Array.isArray(inObject) ? [] : {};
|
||||||
|
// loop over ech entry in object
|
||||||
|
for (key in inObject) {
|
||||||
|
value = inObject[key];
|
||||||
|
// Recursively (deep) copy for nested objects, including arrays
|
||||||
|
outObject[key] = deepCopyFunction(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
return outObject;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* checks if a DOM element actually exists
|
* checks if a DOM element actually exists
|
||||||
* @param {String} id Element id to check for
|
* @param {String} id Element id to check for
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
xmlns="https://getpsalm.org/schema/config"
|
xmlns="https://getpsalm.org/schema/config"
|
||||||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
|
||||||
autoloader="lib/autoloader.php"
|
autoloader="lib/autoloader.php"
|
||||||
|
errorLevel="8"
|
||||||
>
|
>
|
||||||
<projectFiles>
|
<projectFiles>
|
||||||
<file name="admin/class_test.php" />
|
<file name="admin/class_test.php" />
|
||||||
@@ -28,7 +29,8 @@
|
|||||||
<directory name="tmp" />
|
<directory name="tmp" />
|
||||||
<directory name="log" />
|
<directory name="log" />
|
||||||
<directory name="media" />
|
<directory name="media" />
|
||||||
<directory name="lib/pChart" />
|
<directory name="lib/FileUpload" />
|
||||||
|
<directory name="lib/pChart" />
|
||||||
<directory name="lib/pChart2.1.4" />
|
<directory name="lib/pChart2.1.4" />
|
||||||
<directory name="lib/Smarty" />
|
<directory name="lib/Smarty" />
|
||||||
<directory name="lib/smarty-3.1.30" />
|
<directory name="lib/smarty-3.1.30" />
|
||||||
|
|||||||
Reference in New Issue
Block a user