(source)
| 897 | } |
| 898 | |
| 899 | function copyElement(source) { |
| 900 | // Simple values |
| 901 | if (!isObject(source)) { |
| 902 | return source; |
| 903 | } |
| 904 | |
| 905 | // Already copied values |
| 906 | var index = stackSource.indexOf(source); |
| 907 | if (index !== -1) { |
| 908 | return stackDest[index]; |
| 909 | } |
| 910 | |
| 911 | if (isWindow(source) || isScope(source)) { |
| 912 | throw ngMinErr('cpws', |
| 913 | "Can't copy! Making copies of Window or Scope instances is not supported."); |
| 914 | } |
| 915 | |
| 916 | var needsRecurse = false; |
| 917 | var destination = copyType(source); |
| 918 | |
| 919 | if (destination === undefined) { |
| 920 | destination = isArray(source) ? [] : Object.create(getPrototypeOf(source)); |
| 921 | needsRecurse = true; |
| 922 | } |
| 923 | |
| 924 | stackSource.push(source); |
| 925 | stackDest.push(destination); |
| 926 | |
| 927 | return needsRecurse |
| 928 | ? copyRecurse(source, destination) |
| 929 | : destination; |
| 930 | } |
| 931 | |
| 932 | function copyType(source) { |
| 933 | switch (toString.call(source)) { |
no test coverage detected