MCPcopy Create free account
hub / github.com/ampproject/amphtml / cloneWithoutFunctions

Function cloneWithoutFunctions

src/service/action-impl.js:925–936  ·  view source on GitHub ↗

* Clones an object and replaces its function properties with throws. * @param {!T} original * @param {!T=} opt_dest * @return {!T} * @template T * @private

(original, opt_dest)

Source from the content-addressed store, hash-verified

923 * @private
924 */
925function cloneWithoutFunctions(original, opt_dest) {
926 const clone = opt_dest || map();
927 for (const prop in original) {
928 const value = original[prop];
929 if (typeof value === 'function') {
930 clone[prop] = notImplemented;
931 } else {
932 clone[prop] = original[prop];
933 }
934 }
935 return clone;
936}
937
938/** @private */
939function notImplemented() {

Callers 1

constructorMethod · 0.85

Calls 1

mapFunction · 0.90

Tested by

no test coverage detected