Skip to content

Commit ebc4cee

Browse files
committed
Remove copy function
1 parent 769a4b0 commit ebc4cee

18 files changed

+91
-1081
lines changed

dist/angular-ts.cjs.js

Lines changed: 23 additions & 280 deletions
Large diffs are not rendered by default.

dist/angular-ts.esm.js

Lines changed: 23 additions & 280 deletions
Large diffs are not rendered by default.

dist/angular-ts.umd.js

Lines changed: 23 additions & 280 deletions
Large diffs are not rendered by default.

src/loader.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {
22
minErr,
3-
copy,
43
extend,
54
forEach,
65
getNgAttribute,
@@ -63,7 +62,6 @@ export class Angular {
6362

6463
// Utility methods kept for backwards purposes
6564
this.bind = bind;
66-
this.copy = copy;
6765
this.equals = equals;
6866
this.element = jqLite;
6967
this.extend = extend;

src/ng/animateCss.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { copy } from "./utils";
2-
31
/**
42
* @ngdoc service
53
* @name $animateCss
@@ -14,17 +12,16 @@ import { copy } from "./utils";
1412
*/
1513
export function CoreAnimateCssProvider() {
1614
this.$get = [
17-
"$q",
1815
"$$AnimateRunner",
19-
($q, $$AnimateRunner) =>
16+
($$AnimateRunner) =>
2017
function (element, initialOptions) {
2118
// all of the animation functions should create
2219
// a copy of the options data, however, if a
2320
// parent service has already created a copy then
2421
// we should stick to using that
2522
let options = initialOptions || {};
2623
if (!options.$$prepared) {
27-
options = copy(options);
24+
options = structuredClone(options);
2825
}
2926

3027
// there is no point in applying the styles since

src/ng/compile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ import { createEventDirective } from "./directive/ngEventDirs";
270270
* }
271271
* if (!angular.equals(this.items_clone, this.items)) {
272272
* this.log.push('doCheck: items mutated');
273-
* this.items_clone = angular.copy(this.items);
273+
* this.items_clone = structuredClone(this.items);
274274
* }
275275
* };
276276
* }

src/ng/directive/ngOptions.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { NODE_TYPE_COMMENT } from "../../constants";
22
import { jqLite, jqLiteRemove, startingTag } from "../../jqLite";
33
import {
4-
copy,
54
equals,
65
forEach,
76
hashKey,
@@ -356,7 +355,9 @@ export const ngOptionsDirective = [
356355
getViewValueFromOption(option) {
357356
// If the viewValue could be an object that may be mutated by the application,
358357
// we need to make a copy and not return the reference to the value on the option.
359-
return trackBy ? copy(option.viewValue) : option.viewValue;
358+
return trackBy
359+
? structuredClone(option.viewValue)
360+
: option.viewValue;
360361
},
361362
};
362363
},

src/ng/directive/ngRepeat.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,11 @@ import { getBlockNodes } from "../../jqLite";
121121
};
122122
123123
$scope.copy = function() {
124-
$scope.friends = angular.copy($scope.friends);
124+
$scope.friends = structuredClone($scope.friends);
125125
};
126126
127127
$scope.reset = function() {
128-
$scope.friends = angular.copy(friends);
128+
$scope.friends = structuredClone(friends);
129129
};
130130
131131
$scope.reset();

src/ng/location.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { jqLite } from "../jqLite";
22
import { urlResolve } from "./urlUtils";
33
import {
4-
copy,
54
encodeUriSegment,
65
forEach,
76
isBoolean,
@@ -582,7 +581,7 @@ const locationPrototype = {
582581
search = search.toString();
583582
this.$$search = parseKeyValue(search);
584583
} else if (isObject(search)) {
585-
search = copy(search, {});
584+
search = structuredClone(search, {});
586585
// remove object undefined or null properties
587586
forEach(search, (value, key) => {
588587
if (value == null) delete search[key];

src/ng/parse.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
/* eslint-disable no-param-reassign */
2-
/* eslint-disable max-classes-per-file */
3-
/* eslint-disable no-use-before-define */
4-
51
import {
6-
copy,
72
createMap,
83
csp,
94
forEach,
@@ -523,7 +518,7 @@ AST.prototype = {
523518
this.peek().text,
524519
)
525520
) {
526-
primary = copy(this.selfReferential[this.consume().text]);
521+
primary = structuredClone(this.selfReferential[this.consume().text]);
527522
} else if (
528523
Object.prototype.hasOwnProperty.call(
529524
this.options.literals,
@@ -2082,7 +2077,7 @@ export function $ParseProvider() {
20822077
var noUnsafeEval = csp().noUnsafeEval;
20832078
var $parseOptions = {
20842079
csp: noUnsafeEval,
2085-
literals: copy(literals),
2080+
literals: structuredClone(literals),
20862081
isIdentifierStart: isFunction(identStart) && identStart,
20872082
isIdentifierContinue: isFunction(identContinue) && identContinue,
20882083
};

0 commit comments

Comments
 (0)