@angular-wave/angular.ts 0.4.2 → 0.4.3
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/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +7 -7
- package/src/angular.spec.js +1 -264
- package/src/animations/animate-css-driver.js +2 -2
- package/src/animations/animate-css.js +7 -8
- package/src/animations/animate-js-driver.js +1 -3
- package/src/animations/animate-js.js +4 -4
- package/src/animations/animate-queue.js +1 -2
- package/src/animations/animation.js +3 -3
- package/src/animations/shared.js +14 -12
- package/src/core/compile/attributes.js +2 -3
- package/src/core/compile/compile.js +247 -231
- package/src/core/compile/compile.spec.js +46 -51
- package/src/core/compile/compile.test.js +1 -1
- package/src/core/interval/interval.test.js +1 -1
- package/src/core/parse/parse.js +2 -2
- package/src/core/sce/sce.js +1 -2
- package/src/core/scope/scope.js +1 -2
- package/src/directive/attrs/attrs.test.js +11 -0
- package/src/directive/attrs/boolean.html +18 -0
- package/src/directive/attrs/boolean.test.js +11 -0
- package/src/directive/attrs/element-style.html +21 -0
- package/src/directive/attrs/element-style.test.js +11 -0
- package/src/directive/bind/bing-html.spec.js +1 -1
- package/src/directive/form/form.js +12 -19
- package/src/directive/if/if.spec.js +2 -3
- package/src/directive/if/if.test.js +1 -2
- package/src/directive/include/include.js +2 -2
- package/src/directive/input/input.js +1 -2
- package/src/directive/input/input.spec.js +187 -191
- package/src/directive/list/list.js +2 -2
- package/src/directive/model/model.js +12 -17
- package/src/directive/model-options/model-options.js +22 -26
- package/src/directive/options/options.js +1 -3
- package/src/directive/options/options.spec.js +3 -4
- package/src/directive/repeat/repeat.js +2 -2
- package/src/directive/repeat/repeat.spec.js +48 -57
- package/src/directive/select/select.spec.js +9 -10
- package/src/directive/switch/switch.js +1 -2
- package/src/router/directives/state-directives.js +18 -16
- package/src/router/directives/view-directive.js +2 -2
- package/src/router/state/views.js +2 -2
- package/src/router/url/url-service.js +2 -8
- package/src/router/url/url-service.spec.js +3 -4
- package/src/services/http/http.js +5 -6
- package/src/services/http-backend/http-backend.js +19 -17
- package/src/shared/common.js +5 -8
- package/src/shared/jqlite/jqlite.js +14 -12
- package/src/shared/jqlite/jqlite.spec.js +2 -2
- package/src/shared/utils.js +15 -92
- package/types/directive/form/form.d.ts +1 -0
- package/types/shared/common.d.ts +0 -1
- package/types/shared/utils.d.ts +0 -35
package/src/shared/utils.js
CHANGED
|
@@ -288,86 +288,6 @@ export function snakeCase(name, separator) {
|
|
|
288
288
|
);
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
-
/**
|
|
292
|
-
* Invokes the `iterator` function once for each item in `obj` collection, which can be either an
|
|
293
|
-
* object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`
|
|
294
|
-
* is the value of an object property or an array element, `key` is the object property key or
|
|
295
|
-
* array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.
|
|
296
|
-
*
|
|
297
|
-
* It is worth noting that `.forEach` does not iterate over inherited properties because it filters
|
|
298
|
-
* using the `hasOwnProperty` method.
|
|
299
|
-
*
|
|
300
|
-
* Unlike ES262's
|
|
301
|
-
* [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),
|
|
302
|
-
* providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just
|
|
303
|
-
* return the value provided.
|
|
304
|
-
*
|
|
305
|
-
```js
|
|
306
|
-
let values = {name: 'misko', gender: 'male'};
|
|
307
|
-
let log = [];
|
|
308
|
-
forEach(values, function(value, key) {
|
|
309
|
-
this.push(key + ': ' + value);
|
|
310
|
-
}, log);
|
|
311
|
-
expect(log).toEqual(['name: misko', 'gender: male']);
|
|
312
|
-
```
|
|
313
|
-
*
|
|
314
|
-
* @param {Object|Array} obj Object to iterate over.
|
|
315
|
-
* @param {Function} iterator Iterator function.
|
|
316
|
-
* @param {Object=} context Object to become context (`this`) for the iterator function.
|
|
317
|
-
* @returns {Object|Array} Reference to `obj`.
|
|
318
|
-
*/
|
|
319
|
-
export function forEach(obj, iterator, context) {
|
|
320
|
-
let key;
|
|
321
|
-
let length;
|
|
322
|
-
if (obj) {
|
|
323
|
-
if (isFunction(obj)) {
|
|
324
|
-
for (key in obj) {
|
|
325
|
-
if (
|
|
326
|
-
key !== "prototype" &&
|
|
327
|
-
key !== "length" &&
|
|
328
|
-
key !== "name" &&
|
|
329
|
-
Object.prototype.hasOwnProperty.call(obj, key)
|
|
330
|
-
) {
|
|
331
|
-
iterator.call(context, obj[key], key, obj);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
} else if (Array.isArray(obj) || isArrayLike(obj)) {
|
|
335
|
-
const isPrimitive = typeof obj !== "object";
|
|
336
|
-
for (key = 0, length = obj.length; key < length; key++) {
|
|
337
|
-
if (isPrimitive || key in obj) {
|
|
338
|
-
iterator.call(context, obj[key], key, obj);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
} else if (obj.forEach && obj.forEach !== forEach) {
|
|
342
|
-
obj.forEach(iterator, context, obj);
|
|
343
|
-
} else if (isBlankObject(obj)) {
|
|
344
|
-
// Object.create(null) fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
|
|
345
|
-
for (key in obj) {
|
|
346
|
-
iterator.call(context, obj[key], key, obj);
|
|
347
|
-
}
|
|
348
|
-
} else {
|
|
349
|
-
// Slow path for objects which do not have a method `hasOwnProperty`
|
|
350
|
-
for (key in obj) {
|
|
351
|
-
if (Object.hasOwnProperty.call(obj, key)) {
|
|
352
|
-
iterator.call(context, obj[key], key, obj);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return obj;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* when using forEach the params are value, key, but it is often useful to have key, value.
|
|
362
|
-
* @param {function(string, *):any} iteratorFn
|
|
363
|
-
* @returns {function(*, string)}
|
|
364
|
-
*/
|
|
365
|
-
export function reverseParams(iteratorFn) {
|
|
366
|
-
return function (value, key) {
|
|
367
|
-
iteratorFn(key, value);
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
|
|
371
291
|
/**
|
|
372
292
|
* Set or clear the hashkey for an object.
|
|
373
293
|
* @param obj object
|
|
@@ -923,21 +843,24 @@ export function parseKeyValue(keyValue) {
|
|
|
923
843
|
|
|
924
844
|
export function toKeyValue(obj) {
|
|
925
845
|
const parts = [];
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
846
|
+
obj &&
|
|
847
|
+
Object.entries(obj).forEach(([key, value]) => {
|
|
848
|
+
if (Array.isArray(value)) {
|
|
849
|
+
value.forEach((arrayValue) => {
|
|
850
|
+
parts.push(
|
|
851
|
+
encodeUriQuery(key, true) +
|
|
852
|
+
(arrayValue === true
|
|
853
|
+
? ""
|
|
854
|
+
: `=${encodeUriQuery(arrayValue, true)}`),
|
|
855
|
+
);
|
|
856
|
+
});
|
|
857
|
+
} else {
|
|
929
858
|
parts.push(
|
|
930
859
|
encodeUriQuery(key, true) +
|
|
931
|
-
(
|
|
860
|
+
(value === true ? "" : `=${encodeUriQuery(value, true)}`),
|
|
932
861
|
);
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
parts.push(
|
|
936
|
-
encodeUriQuery(key, true) +
|
|
937
|
-
(value === true ? "" : `=${encodeUriQuery(value, true)}`),
|
|
938
|
-
);
|
|
939
|
-
}
|
|
940
|
-
});
|
|
862
|
+
}
|
|
863
|
+
});
|
|
941
864
|
return parts.length ? parts.join("&") : "";
|
|
942
865
|
}
|
|
943
866
|
|
package/types/shared/common.d.ts
CHANGED
package/types/shared/utils.d.ts
CHANGED
|
@@ -163,41 +163,6 @@ export function isArrayBuffer(obj: any): boolean;
|
|
|
163
163
|
*/
|
|
164
164
|
export function trim(value: any): string | any;
|
|
165
165
|
export function snakeCase(name: any, separator: any): any;
|
|
166
|
-
/**
|
|
167
|
-
* Invokes the `iterator` function once for each item in `obj` collection, which can be either an
|
|
168
|
-
* object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`
|
|
169
|
-
* is the value of an object property or an array element, `key` is the object property key or
|
|
170
|
-
* array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.
|
|
171
|
-
*
|
|
172
|
-
* It is worth noting that `.forEach` does not iterate over inherited properties because it filters
|
|
173
|
-
* using the `hasOwnProperty` method.
|
|
174
|
-
*
|
|
175
|
-
* Unlike ES262's
|
|
176
|
-
* [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),
|
|
177
|
-
* providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just
|
|
178
|
-
* return the value provided.
|
|
179
|
-
*
|
|
180
|
-
```js
|
|
181
|
-
let values = {name: 'misko', gender: 'male'};
|
|
182
|
-
let log = [];
|
|
183
|
-
forEach(values, function(value, key) {
|
|
184
|
-
this.push(key + ': ' + value);
|
|
185
|
-
}, log);
|
|
186
|
-
expect(log).toEqual(['name: misko', 'gender: male']);
|
|
187
|
-
```
|
|
188
|
-
*
|
|
189
|
-
* @param {Object|Array} obj Object to iterate over.
|
|
190
|
-
* @param {Function} iterator Iterator function.
|
|
191
|
-
* @param {Object=} context Object to become context (`this`) for the iterator function.
|
|
192
|
-
* @returns {Object|Array} Reference to `obj`.
|
|
193
|
-
*/
|
|
194
|
-
export function forEach(obj: any | any[], iterator: Function, context?: any | undefined): any | any[];
|
|
195
|
-
/**
|
|
196
|
-
* when using forEach the params are value, key, but it is often useful to have key, value.
|
|
197
|
-
* @param {function(string, *):any} iteratorFn
|
|
198
|
-
* @returns {function(*, string)}
|
|
199
|
-
*/
|
|
200
|
-
export function reverseParams(iteratorFn: (arg0: string, arg1: any) => any): (arg0: any, arg1: string) => any;
|
|
201
166
|
/**
|
|
202
167
|
* Set or clear the hashkey for an object.
|
|
203
168
|
* @param obj object
|