MCPcopy Create free account
hub / github.com/OpenReservation/OpenReservation / copyType

Function copyType

OpenReservation/wwwroot/Scripts/angular.js:932–969  ·  view source on GitHub ↗
(source)

Source from the content-addressed store, hash-verified

930 }
931
932 function copyType(source) {
933 switch (toString.call(source)) {
934 case '[object Int8Array]':
935 case '[object Int16Array]':
936 case '[object Int32Array]':
937 case '[object Float32Array]':
938 case '[object Float64Array]':
939 case '[object Uint8Array]':
940 case '[object Uint8ClampedArray]':
941 case '[object Uint16Array]':
942 case '[object Uint32Array]':
943 return new source.constructor(copyElement(source.buffer));
944
945 case '[object ArrayBuffer]':
946 //Support: IE10
947 if (!source.slice) {
948 var copied = new ArrayBuffer(source.byteLength);
949 new Uint8Array(copied).set(new Uint8Array(source));
950 return copied;
951 }
952 return source.slice(0);
953
954 case '[object Boolean]':
955 case '[object Number]':
956 case '[object String]':
957 case '[object Date]':
958 return new source.constructor(source.valueOf());
959
960 case '[object RegExp]':
961 var re = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
962 re.lastIndex = source.lastIndex;
963 return re;
964 }
965
966 if (isFunction(source.cloneNode)) {
967 return source.cloneNode(true);
968 }
969 }
970 }
971
972 /**

Callers 1

copyElementFunction · 0.85

Calls 2

copyElementFunction · 0.85
isFunctionFunction · 0.85

Tested by

no test coverage detected