@angular-wave/angular.ts 0.0.61 → 0.0.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@angular-wave/angular.ts",
3
+ "description": "A modern, optimized and typesafe version of AngularJS",
3
4
  "license": "MIT",
4
- "version": "0.0.61",
5
+ "version": "0.0.62",
5
6
  "type": "module",
6
7
  "main": "dist/angular-ts.esm.js",
7
8
  "browser": "dist/angular-ts.umd.js",
@@ -2084,8 +2084,8 @@ describe("angular", () => {
2084
2084
  body,
2085
2085
  element,
2086
2086
  ];
2087
- angular.forEach(tests, (value, idx) => {
2088
- const result = angular.isElement(value);
2087
+ forEach(tests, (value, idx) => {
2088
+ const result = isElement(value);
2089
2089
  expect(typeof result).toEqual("boolean");
2090
2090
  expect(result).toEqual(expected[idx]);
2091
2091
  });
@@ -7,7 +7,6 @@ import {
7
7
  csp,
8
8
  valueFn,
9
9
  extend,
10
- identity,
11
10
  } from "../../shared/utils";
12
11
  import { publishExternalAPI } from "../../public";
13
12
  import { createInjector } from "../../injector";
@@ -3673,7 +3672,10 @@ describe("parser", () => {
3673
3672
  });
3674
3673
 
3675
3674
  it("should always be invoked if flagged as $stateful when wrapping one-time with inputs", () => {
3676
- filterProvider.register("identity", valueFn(identity));
3675
+ filterProvider.register(
3676
+ "identity",
3677
+ valueFn((x) => x),
3678
+ );
3677
3679
 
3678
3680
  let interceptorCalls = 0;
3679
3681
  function interceptor() {
@@ -3799,7 +3801,7 @@ describe("parser", () => {
3799
3801
 
3800
3802
  it("should not affect when a one-time binding becomes stable", () => {
3801
3803
  scope.$watch($parse("::x"));
3802
- scope.$watch($parse("::x", identity));
3804
+ scope.$watch($parse("::x", (x) => x));
3803
3805
  scope.$watch($parse("::x", () => 1)); // interceptor that returns non-undefined
3804
3806
 
3805
3807
  scope.$digest();
@@ -3812,7 +3814,7 @@ describe("parser", () => {
3812
3814
 
3813
3815
  it("should not affect when a one-time literal binding becomes stable", () => {
3814
3816
  scope.$watch($parse("::[x]"));
3815
- scope.$watch($parse("::[x]", identity));
3817
+ scope.$watch($parse("::[x]", (x) => x));
3816
3818
  scope.$watch($parse("::[x]", () => 1)); // interceptor that returns non-literal
3817
3819
 
3818
3820
  scope.$digest();
@@ -3846,7 +3848,7 @@ describe("parser", () => {
3846
3848
  scope.$watch(
3847
3849
  $parse(
3848
3850
  $parse("::{x:x, y:y}", (lit) => lit.x),
3849
- identity,
3851
+ (x) => x,
3850
3852
  ),
3851
3853
  (val) => logs.push(val),
3852
3854
  );
@@ -5,7 +5,6 @@ import {
5
5
  isArrayLike,
6
6
  isString,
7
7
  minErr,
8
- identity,
9
8
  } from "../shared/utils";
10
9
 
11
10
  orderByFilter.$inject = ["$parse"];
@@ -75,7 +74,7 @@ export function orderByFilter($parse) {
75
74
  function processPredicates(sortPredicates) {
76
75
  return sortPredicates.map((predicate) => {
77
76
  let descending = 1;
78
- let get = identity;
77
+ let get = (x) => x;
79
78
 
80
79
  if (isFunction(predicate)) {
81
80
  get = predicate;
package/src/index.js CHANGED
@@ -4,7 +4,7 @@ import { publishExternalAPI } from "./public";
4
4
  /**
5
5
  * @type {Angular}
6
6
  */
7
- const angular = new Angular();
7
+ export const angular = new Angular();
8
8
  window["angular"] = angular;
9
9
 
10
10
  publishExternalAPI();
package/src/loader.js CHANGED
@@ -16,7 +16,6 @@ import {
16
16
  bind,
17
17
  fromJson,
18
18
  toJson,
19
- identity,
20
19
  equals,
21
20
  assertNotHasOwnProperty,
22
21
  isBoolean,
@@ -58,58 +57,9 @@ export class Angular {
58
57
  /** @type {string} */
59
58
  this.version = VERSION;
60
59
 
61
- // Utility methods kept for backwards purposes
62
- /** @type {bind} */
63
- this.bind = bind;
64
-
65
- /** @type {equals} */
66
- this.equals = equals;
67
-
68
60
  /** @type {typeof import('./shared/jqlite/jqlite').JQLite} */
69
61
  this.element = JQLite;
70
62
 
71
- /** @type {extend} */
72
- this.extend = extend;
73
-
74
- /** @type {forEach} */
75
- this.forEach = forEach;
76
-
77
- /** @type {fromJson} */
78
- this.fromJson = fromJson;
79
-
80
- /** @type {toJson} */
81
- this.toJson = toJson;
82
-
83
- /** @type {identity} */
84
- this.identity = identity;
85
-
86
- /** @type {isDate} */
87
- this.isDate = isDate;
88
-
89
- /** @type {isDefined} */
90
- this.isDefined = isDefined;
91
-
92
- /** @type {isElement} */
93
- this.isElement = isElement;
94
-
95
- /** @type {isFunction} */
96
- this.isFunction = isFunction;
97
-
98
- /** @type {isNumber} */
99
- this.isNumber = isNumber;
100
-
101
- /** @type {isObject} */
102
- this.isObject = isObject;
103
-
104
- /** @type {isString} */
105
- this.isString = isString;
106
-
107
- /** @type {isUndefined} */
108
- this.isUndefined = isUndefined;
109
-
110
- /** @type {merge} */
111
- this.merge = merge;
112
-
113
63
  /** @type {errorHandlingConfig} */
114
64
  this.errorHandlingConfig = errorHandlingConfig;
115
65
 
@@ -117,7 +117,7 @@ export class StateProvider {
117
117
  * let result = {},
118
118
  * views = parent(state);
119
119
  *
120
- * angular.forEach(views, function (config, name) {
120
+ * forEach(views, function (config, name) {
121
121
  * let autoName = (state.name + '.' + name).replace('.', '/');
122
122
  * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';
123
123
  * result[name] = config;
@@ -2,6 +2,7 @@ import { dealoc } from "../../shared/jqlite/jqlite";
2
2
  import { Angular } from "../../loader";
3
3
  import { publishExternalAPI } from "../../public";
4
4
  import { map, find } from "../../shared/common";
5
+ import { forEach } from "../../shared/utils";
5
6
 
6
7
  describe("UrlMatcher", () => {
7
8
  let $url;
@@ -245,7 +246,7 @@ describe("UrlMatcher", () => {
245
246
  "/url/someword/child/childParam",
246
247
  };
247
248
 
248
- angular.forEach(shouldPass, function (url, route) {
249
+ forEach(shouldPass, function (url, route) {
249
250
  expect($url.compile(route).exec(url, {})).toEqual({
250
251
  childParam: "childParam",
251
252
  matchedParam: "someword",
@@ -261,7 +262,7 @@ describe("UrlMatcher", () => {
261
262
  "/url/someword/child/childParam",
262
263
  };
263
264
 
264
- angular.forEach(shouldThrow, function (url, route) {
265
+ forEach(shouldThrow, function (url, route) {
265
266
  expect(() => {
266
267
  $url.compile(route).exec(url, {});
267
268
  }).toThrowError("Unbalanced capture group in route '" + route + "'");
@@ -274,7 +275,7 @@ describe("UrlMatcher", () => {
274
275
  "/url/someword/child/childParam",
275
276
  };
276
277
 
277
- angular.forEach(shouldPass, function (url, route) {
278
+ forEach(shouldPass, function (url, route) {
278
279
  expect(() => {
279
280
  $url.compile(route).exec(url, {});
280
281
  }).not.toThrow();
@@ -307,7 +307,7 @@ export function snakeCase(name, separator) {
307
307
  ```js
308
308
  let values = {name: 'misko', gender: 'male'};
309
309
  let log = [];
310
- angular.forEach(values, function(value, key) {
310
+ forEach(values, function(value, key) {
311
311
  this.push(key + ': ' + value);
312
312
  }, log);
313
313
  expect(log).toEqual(['name: misko', 'gender: male']);
@@ -496,15 +496,6 @@ export function inherit(parent, extra) {
496
496
  return extend(Object.create(parent), extra);
497
497
  }
498
498
 
499
- /**
500
- *
501
- * @param {*} value to be returned.
502
- * @returns {*} the value passed in.
503
- */
504
- export function identity(value) {
505
- return value;
506
- }
507
-
508
499
  /**
509
500
  * @param {*} value
510
501
  * @returns {() => *}
package/types/index.d.ts CHANGED
@@ -1 +1,5 @@
1
- export {};
1
+ /**
2
+ * @type {Angular}
3
+ */
4
+ export const angular: Angular;
5
+ import { Angular } from "./loader";
package/types/loader.d.ts CHANGED
@@ -196,40 +196,8 @@ export class Angular {
196
196
  cache: Map<number, import("./core/cache/cache").ExpandoStore>;
197
197
  /** @type {string} */
198
198
  version: string;
199
- /** @type {bind} */
200
- bind: typeof bind;
201
- /** @type {equals} */
202
- equals: typeof equals;
203
199
  /** @type {typeof import('./shared/jqlite/jqlite').JQLite} */
204
200
  element: typeof import("./shared/jqlite/jqlite").JQLite;
205
- /** @type {extend} */
206
- extend: typeof extend;
207
- /** @type {forEach} */
208
- forEach: typeof forEach;
209
- /** @type {fromJson} */
210
- fromJson: typeof fromJson;
211
- /** @type {toJson} */
212
- toJson: typeof toJson;
213
- /** @type {identity} */
214
- identity: typeof identity;
215
- /** @type {isDate} */
216
- isDate: typeof isDate;
217
- /** @type {isDefined} */
218
- isDefined: typeof isDefined;
219
- /** @type {isElement} */
220
- isElement: typeof isElement;
221
- /** @type {isFunction} */
222
- isFunction: typeof isFunction;
223
- /** @type {isNumber} */
224
- isNumber: typeof isNumber;
225
- /** @type {isObject} */
226
- isObject: typeof isObject;
227
- /** @type {isString} */
228
- isString: typeof isString;
229
- /** @type {isUndefined} */
230
- isUndefined: typeof isUndefined;
231
- /** @type {merge} */
232
- merge: typeof merge;
233
201
  /** @type {errorHandlingConfig} */
234
202
  errorHandlingConfig: typeof errorHandlingConfig;
235
203
  /** @type {Function} */
@@ -375,19 +343,3 @@ export type AngularBootstrapConfig = {
375
343
  */
376
344
  strictDi?: boolean;
377
345
  };
378
- import { bind } from "./shared/utils";
379
- import { equals } from "./shared/utils";
380
- import { extend } from "./shared/utils";
381
- import { forEach } from "./shared/utils";
382
- import { fromJson } from "./shared/utils";
383
- import { toJson } from "./shared/utils";
384
- import { identity } from "./shared/utils";
385
- import { isDate } from "./shared/utils";
386
- import { isDefined } from "./shared/utils";
387
- import { isElement } from "./shared/utils";
388
- import { isFunction } from "./shared/utils";
389
- import { isNumber } from "./shared/utils";
390
- import { isObject } from "./shared/utils";
391
- import { isString } from "./shared/utils";
392
- import { isUndefined } from "./shared/utils";
393
- import { merge } from "./shared/utils";
@@ -75,7 +75,7 @@ export class StateProvider {
75
75
  * let result = {},
76
76
  * views = parent(state);
77
77
  *
78
- * angular.forEach(views, function (config, name) {
78
+ * forEach(views, function (config, name) {
79
79
  * let autoName = (state.name + '.' + name).replace('.', '/');
80
80
  * config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';
81
81
  * result[name] = config;
@@ -182,7 +182,7 @@ export function snakeCase(name: any, separator: any): any;
182
182
  ```js
183
183
  let values = {name: 'misko', gender: 'male'};
184
184
  let log = [];
185
- angular.forEach(values, function(value, key) {
185
+ forEach(values, function(value, key) {
186
186
  this.push(key + ': ' + value);
187
187
  }, log);
188
188
  expect(log).toEqual(['name: misko', 'gender: male']);
@@ -266,12 +266,6 @@ export function isNumberNaN(num: any): boolean;
266
266
  * @returns {Object}
267
267
  */
268
268
  export function inherit(parent: any, extra: any): any;
269
- /**
270
- *
271
- * @param {*} value to be returned.
272
- * @returns {*} the value passed in.
273
- */
274
- export function identity(value: any): any;
275
269
  /**
276
270
  * @param {*} value
277
271
  * @returns {() => *}