fargv
Version:
Multi-customizable parser of process.argv for nodejs.
24 lines (13 loc) • 488 B
JavaScript
const isObject = require("./isObject");
const { deepCloneObject, deepCloneArray } = require("./deepClone");
const copyValueWithoutBinding = function(sourceValue) {
//to ignore isObject && isArray checks
if(!sourceValue) return sourceValue;
if(isObject(sourceValue)) {
return deepCloneObject({}, sourceValue);
} else if(Array.isArray(sourceValue)) {
return deepCloneArray([], sourceValue);
}
return sourceValue;
};
module.exports = copyValueWithoutBinding;