diff options
Diffstat (limited to 'node_modules/structured-clone/clone.js')
-rw-r--r-- | node_modules/structured-clone/clone.js | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/node_modules/structured-clone/clone.js b/node_modules/structured-clone/clone.js deleted file mode 100644 index df1e4884e..000000000 --- a/node_modules/structured-clone/clone.js +++ /dev/null @@ -1,38 +0,0 @@ -// Implement the clone algorithm directly. -// https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/The_structured_clone_algorithm - -function clone (oToBeCloned, cloned, clonedpairs) -{ - cloned = cloned || []; - clonedpairs = clonedpairs || []; - - if (cloned.indexOf(oToBeCloned) > -1) { - return clonedpairs[cloned.indexOf(oToBeCloned)]; - } - - if (oToBeCloned === null || !(oToBeCloned instanceof Object)) { return oToBeCloned; } - var oClone, fConstr = oToBeCloned.constructor; - switch (fConstr) { - case RegExp: - oClone = new fConstr(oToBeCloned.source, "g".substr(0, Number(oToBeCloned.global)) + "i".substr(0, Number(oToBeCloned.ignoreCase)) + "m".substr(0, Number(oToBeCloned.multiline))); - break; - case Date: - oClone = new fConstr(oToBeCloned.getTime()); - break; - // etc. - default: - if (Buffer.isBuffer(oToBeCloned)) { - oClone = new Buffer(oToBeCloned.length); - oToBeCloned.copy(oClone); - } else if (oToBeCloned instanceof Error) { - oClone = new Error(oToBeCloned.message); - } else { - oClone = new fConstr(); - cloned.push(oToBeCloned); clonedpairs.push(oClone); - for (var sProp in oToBeCloned) { oClone[sProp] = clone(oToBeCloned[sProp], cloned, clonedpairs); } - } - } - return oClone; -} - -exports.clone = clone;
\ No newline at end of file |