ember-source 4.9.0-alpha.2 → 4.9.0-alpha.4
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/CHANGELOG.md +9 -0
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +9 -4
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +1 -1
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +29 -1428
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/container/index.js +1 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +5 -5
- package/dist/packages/@ember/-internals/meta/lib/meta.js +13 -13
- package/dist/packages/@ember/array/index.js +0 -909
- package/dist/packages/@ember/array/proxy.js +0 -31
- package/dist/packages/@ember/controller/index.js +0 -156
- package/dist/packages/@ember/debug/data-adapter.js +8 -2
- package/dist/packages/@ember/object/observable.js +0 -228
- package/dist/packages/@ember/object/promise-proxy-mixin.js +0 -80
- package/dist/packages/@ember/routing/route.js +1 -1
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +262 -383
- package/package.json +14 -10
- package/types/preview/@ember/routing/route.d.ts +3 -4
- package/types/stable/index.d.ts +12 -0
package/dist/ember.debug.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
|
|
7
7
|
* @license Licensed under MIT license
|
|
8
8
|
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
|
|
9
|
-
* @version 4.9.0-alpha.
|
|
9
|
+
* @version 4.9.0-alpha.4
|
|
10
10
|
*/
|
|
11
11
|
/* eslint-disable no-var */
|
|
12
12
|
|
|
@@ -364,7 +364,7 @@ define("@ember/-internals/container/index", ["exports", "@ember/-internals/owner
|
|
|
364
364
|
function wrapManagerInDeprecationProxy(manager) {
|
|
365
365
|
var validator = {
|
|
366
366
|
set(_obj, prop) {
|
|
367
|
-
throw new Error(`You attempted to set "${prop}" on a factory manager created by container#factoryFor. A factory manager is a read-only construct.`);
|
|
367
|
+
throw new Error(`You attempted to set "${String(prop)}" on a factory manager created by container#factoryFor. A factory manager is a read-only construct.`);
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
}; // Note:
|
|
@@ -4153,7 +4153,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
4153
4153
|
(true && !(_element !== null) && (0, _debug.assert)(`Cannot call \`readDOMAttr\` on ${this} which does not have an element`, _element !== null));
|
|
4154
4154
|
var element = _element;
|
|
4155
4155
|
var isSVG = element.namespaceURI === "http://www.w3.org/2000/svg"
|
|
4156
|
-
/* SVG */
|
|
4156
|
+
/* Namespace.SVG */
|
|
4157
4157
|
;
|
|
4158
4158
|
var {
|
|
4159
4159
|
type,
|
|
@@ -6254,7 +6254,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
6254
6254
|
(true && !(owner.hasRegistration(`engine:${name}`)) && (0, _debug.assert)(`You used \`{{mount '${name}'}}\`, but the engine '${name}' can not be found.`, owner.hasRegistration(`engine:${name}`)));
|
|
6255
6255
|
lastName = name;
|
|
6256
6256
|
lastDef = (0, _runtime.curry)(0
|
|
6257
|
-
/* Component */
|
|
6257
|
+
/* CurriedType.Component */
|
|
6258
6258
|
, new MountDefinition(name), owner, captured, true);
|
|
6259
6259
|
return lastDef;
|
|
6260
6260
|
} else {
|
|
@@ -6337,7 +6337,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
6337
6337
|
|
|
6338
6338
|
var args = (0, _runtime.createCapturedArgs)(named, _runtime.EMPTY_POSITIONAL);
|
|
6339
6339
|
definition = (0, _runtime.curry)(0
|
|
6340
|
-
/* Component */
|
|
6340
|
+
/* CurriedType.Component */
|
|
6341
6341
|
, new OutletComponentDefinition(state), (_b = (_a = outletState === null || outletState === void 0 ? void 0 : outletState.render) === null || _a === void 0 ? void 0 : _a.owner) !== null && _b !== void 0 ? _b : owner, args, true);
|
|
6342
6342
|
} else {
|
|
6343
6343
|
definition = null;
|
|
@@ -6965,7 +6965,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
6965
6965
|
var definition = createRootOutlet(view);
|
|
6966
6966
|
|
|
6967
6967
|
this._appendDefinition(view, (0, _runtime.curry)(0
|
|
6968
|
-
/* Component */
|
|
6968
|
+
/* CurriedType.Component */
|
|
6969
6969
|
, definition, view.owner, null, true), target);
|
|
6970
6970
|
}
|
|
6971
6971
|
|
|
@@ -6973,7 +6973,7 @@ define("@ember/-internals/glimmer/index", ["exports", "@glimmer/opcode-compiler"
|
|
|
6973
6973
|
var definition = new RootComponentDefinition(view);
|
|
6974
6974
|
|
|
6975
6975
|
this._appendDefinition(view, (0, _runtime.curry)(0
|
|
6976
|
-
/* Component */
|
|
6976
|
+
/* CurriedType.Component */
|
|
6977
6977
|
, definition, this._owner, null, true), target);
|
|
6978
6978
|
}
|
|
6979
6979
|
|
|
@@ -7742,9 +7742,9 @@ define("@ember/-internals/meta/lib/meta", ["exports", "@ember/-internals/utils",
|
|
|
7742
7742
|
}
|
|
7743
7743
|
|
|
7744
7744
|
this.pushListener(eventName, target, method, once ? 1
|
|
7745
|
-
/* ONCE */
|
|
7745
|
+
/* ListenerKind.ONCE */
|
|
7746
7746
|
: 0
|
|
7747
|
-
/* ADD */
|
|
7747
|
+
/* ListenerKind.ADD */
|
|
7748
7748
|
, sync);
|
|
7749
7749
|
}
|
|
7750
7750
|
/** @internal */
|
|
@@ -7758,7 +7758,7 @@ define("@ember/-internals/meta/lib/meta", ["exports", "@ember/-internals/utils",
|
|
|
7758
7758
|
}
|
|
7759
7759
|
|
|
7760
7760
|
this.pushListener(eventName, target, method, 2
|
|
7761
|
-
/* REMOVE */
|
|
7761
|
+
/* ListenerKind.REMOVE */
|
|
7762
7762
|
);
|
|
7763
7763
|
}
|
|
7764
7764
|
|
|
@@ -7782,7 +7782,7 @@ define("@ember/-internals/meta/lib/meta", ["exports", "@ember/-internals/utils",
|
|
|
7782
7782
|
if (i === -1) {
|
|
7783
7783
|
(true && !(!(this.isPrototypeMeta(this.source) && typeof method === 'function')) && (0, _debug.assert)('You cannot add function listeners to prototypes. Convert the listener to a string listener, or add it to the instance instead.', !(this.isPrototypeMeta(this.source) && typeof method === 'function')));
|
|
7784
7784
|
(true && !(!(!this.isPrototypeMeta(this.source) && typeof method === 'function' && kind === 2
|
|
7785
|
-
/* REMOVE */
|
|
7785
|
+
/* ListenerKind.REMOVE */
|
|
7786
7786
|
)) && (0, _debug.assert)('You attempted to remove a function listener which did not exist on the instance, which means you may have attempted to remove it before it was added.', !(!this.isPrototypeMeta(this.source) && typeof method === 'function' && kind === 2)));
|
|
7787
7787
|
listeners.push({
|
|
7788
7788
|
event,
|
|
@@ -7797,16 +7797,16 @@ define("@ember/-internals/meta/lib/meta", ["exports", "@ember/-internals/utils",
|
|
|
7797
7797
|
// want to splice it out entirely so we don't hold onto a reference.
|
|
7798
7798
|
|
|
7799
7799
|
if (kind === 2
|
|
7800
|
-
/* REMOVE */
|
|
7800
|
+
/* ListenerKind.REMOVE */
|
|
7801
7801
|
&& listener.kind !== 2
|
|
7802
|
-
/* REMOVE */
|
|
7802
|
+
/* ListenerKind.REMOVE */
|
|
7803
7803
|
) {
|
|
7804
7804
|
listeners.splice(i, 1);
|
|
7805
7805
|
} else {
|
|
7806
7806
|
(true && !(!(listener.kind === 0
|
|
7807
|
-
/* ADD */
|
|
7807
|
+
/* ListenerKind.ADD */
|
|
7808
7808
|
&& kind === 0
|
|
7809
|
-
/* ADD */
|
|
7809
|
+
/* ListenerKind.ADD */
|
|
7810
7810
|
&& listener.sync !== sync)) && (0, _debug.assert)(`You attempted to add an observer for the same method on '${event.split(':')[0]}' twice to ${target} as both sync and async. Observers must be either sync or async, they cannot be both. This is likely a mistake, you should either remove the code that added the observer a second time, or update it to always be sync or async. The method was ${String(method)}.`, !(listener.kind === 0 && kind === 0 && listener.sync !== sync))); // update own listener
|
|
7811
7811
|
|
|
7812
7812
|
listener.kind = kind;
|
|
@@ -7933,9 +7933,9 @@ define("@ember/-internals/meta/lib/meta", ["exports", "@ember/-internals/utils",
|
|
|
7933
7933
|
// REMOVE listeners are placeholders that tell us not to
|
|
7934
7934
|
// inherit, so they never match. Only ADD and ONCE can match.
|
|
7935
7935
|
if (listener.event === eventName && (listener.kind === 0
|
|
7936
|
-
/* ADD */
|
|
7936
|
+
/* ListenerKind.ADD */
|
|
7937
7937
|
|| listener.kind === 1
|
|
7938
|
-
/* ONCE */
|
|
7938
|
+
/* ListenerKind.ONCE */
|
|
7939
7939
|
)) {
|
|
7940
7940
|
if (result === undefined) {
|
|
7941
7941
|
// we create this array only after we've found a listener that
|
|
@@ -7944,7 +7944,7 @@ define("@ember/-internals/meta/lib/meta", ["exports", "@ember/-internals/utils",
|
|
|
7944
7944
|
}
|
|
7945
7945
|
|
|
7946
7946
|
result.push(listener.target, listener.method, listener.kind === 1
|
|
7947
|
-
/* ONCE */
|
|
7947
|
+
/* ListenerKind.ONCE */
|
|
7948
7948
|
);
|
|
7949
7949
|
}
|
|
7950
7950
|
}
|
|
@@ -7970,9 +7970,9 @@ define("@ember/-internals/meta/lib/meta", ["exports", "@ember/-internals/utils",
|
|
|
7970
7970
|
// REMOVE listeners are placeholders that tell us not to
|
|
7971
7971
|
// inherit, so they never match. Only ADD and ONCE can match.
|
|
7972
7972
|
if ((listener.kind === 0
|
|
7973
|
-
/* ADD */
|
|
7973
|
+
/* ListenerKind.ADD */
|
|
7974
7974
|
|| listener.kind === 1
|
|
7975
|
-
/* ONCE */
|
|
7975
|
+
/* ListenerKind.ONCE */
|
|
7976
7976
|
) && listener.event.indexOf(':change') !== -1) {
|
|
7977
7977
|
if (result === undefined) {
|
|
7978
7978
|
// we create this array only after we've found a listener that
|
|
@@ -16441,65 +16441,10 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
16441
16441
|
(0, _utils.setEmberArray)(this);
|
|
16442
16442
|
},
|
|
16443
16443
|
|
|
16444
|
-
/**
|
|
16445
|
-
__Required.__ You must implement this method to apply this mixin.
|
|
16446
|
-
Your array must support the `length` property. Your replace methods should
|
|
16447
|
-
set this property whenever it changes.
|
|
16448
|
-
@property {Number} length
|
|
16449
|
-
@public
|
|
16450
|
-
*/
|
|
16451
|
-
|
|
16452
|
-
/**
|
|
16453
|
-
Returns the object at the given `index`. If the given `index` is negative
|
|
16454
|
-
or is greater or equal than the array length, returns `undefined`.
|
|
16455
|
-
This is one of the primitives you must implement to support `EmberArray`.
|
|
16456
|
-
If your object supports retrieving the value of an array item using `get()`
|
|
16457
|
-
(i.e. `myArray.get(0)`), then you do not need to implement this method
|
|
16458
|
-
yourself.
|
|
16459
|
-
```javascript
|
|
16460
|
-
let arr = ['a', 'b', 'c', 'd'];
|
|
16461
|
-
arr.objectAt(0); // 'a'
|
|
16462
|
-
arr.objectAt(3); // 'd'
|
|
16463
|
-
arr.objectAt(-1); // undefined
|
|
16464
|
-
arr.objectAt(4); // undefined
|
|
16465
|
-
arr.objectAt(5); // undefined
|
|
16466
|
-
```
|
|
16467
|
-
@method objectAt
|
|
16468
|
-
@param {Number} idx The index of the item to return.
|
|
16469
|
-
@return {*} item at index or undefined
|
|
16470
|
-
@public
|
|
16471
|
-
*/
|
|
16472
|
-
|
|
16473
|
-
/**
|
|
16474
|
-
This returns the objects at the specified indexes, using `objectAt`.
|
|
16475
|
-
```javascript
|
|
16476
|
-
let arr = ['a', 'b', 'c', 'd'];
|
|
16477
|
-
arr.objectsAt([0, 1, 2]); // ['a', 'b', 'c']
|
|
16478
|
-
arr.objectsAt([2, 3, 4]); // ['c', 'd', undefined]
|
|
16479
|
-
```
|
|
16480
|
-
@method objectsAt
|
|
16481
|
-
@param {Array} indexes An array of indexes of items to return.
|
|
16482
|
-
@return {Array}
|
|
16483
|
-
@public
|
|
16484
|
-
*/
|
|
16485
16444
|
objectsAt(indexes) {
|
|
16486
16445
|
return indexes.map(idx => (0, _metal.objectAt)(this, idx));
|
|
16487
16446
|
},
|
|
16488
16447
|
|
|
16489
|
-
/**
|
|
16490
|
-
This is the handler for the special array content property. If you get
|
|
16491
|
-
this property, it will return this. If you set this property to a new
|
|
16492
|
-
array, it will replace the current content.
|
|
16493
|
-
```javascript
|
|
16494
|
-
let peopleToMoon = ['Armstrong', 'Aldrin'];
|
|
16495
|
-
peopleToMoon.get('[]'); // ['Armstrong', 'Aldrin']
|
|
16496
|
-
peopleToMoon.set('[]', ['Collins']); // ['Collins']
|
|
16497
|
-
peopleToMoon.get('[]'); // ['Collins']
|
|
16498
|
-
```
|
|
16499
|
-
@property []
|
|
16500
|
-
@return this
|
|
16501
|
-
@public
|
|
16502
|
-
*/
|
|
16503
16448
|
'[]': nonEnumerableComputed({
|
|
16504
16449
|
get() {
|
|
16505
16450
|
return this;
|
|
@@ -16511,55 +16456,14 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
16511
16456
|
}
|
|
16512
16457
|
|
|
16513
16458
|
}),
|
|
16514
|
-
|
|
16515
|
-
/**
|
|
16516
|
-
The first object in the array, or `undefined` if the array is empty.
|
|
16517
|
-
```javascript
|
|
16518
|
-
let vowels = ['a', 'e', 'i', 'o', 'u'];
|
|
16519
|
-
vowels.firstObject; // 'a'
|
|
16520
|
-
vowels.shiftObject();
|
|
16521
|
-
vowels.firstObject; // 'e'
|
|
16522
|
-
vowels.reverseObjects();
|
|
16523
|
-
vowels.firstObject; // 'u'
|
|
16524
|
-
vowels.clear();
|
|
16525
|
-
vowels.firstObject; // undefined
|
|
16526
|
-
```
|
|
16527
|
-
@property firstObject
|
|
16528
|
-
@return {Object | undefined} The first object in the array
|
|
16529
|
-
@public
|
|
16530
|
-
*/
|
|
16531
16459
|
firstObject: nonEnumerableComputed(function () {
|
|
16532
16460
|
return (0, _metal.objectAt)(this, 0);
|
|
16533
16461
|
}).readOnly(),
|
|
16534
|
-
|
|
16535
|
-
/**
|
|
16536
|
-
The last object in the array, or `undefined` if the array is empty.
|
|
16537
|
-
@property lastObject
|
|
16538
|
-
@return {Object | undefined} The last object in the array
|
|
16539
|
-
@public
|
|
16540
|
-
*/
|
|
16541
16462
|
lastObject: nonEnumerableComputed(function () {
|
|
16542
16463
|
return (0, _metal.objectAt)(this, this.length - 1);
|
|
16543
16464
|
}).readOnly(),
|
|
16544
16465
|
|
|
16545
16466
|
// Add any extra methods to EmberArray that are native to the built-in Array.
|
|
16546
|
-
|
|
16547
|
-
/**
|
|
16548
|
-
Returns a new array that is a slice of the receiver. This implementation
|
|
16549
|
-
uses the observable array methods to retrieve the objects for the new
|
|
16550
|
-
slice.
|
|
16551
|
-
```javascript
|
|
16552
|
-
let arr = ['red', 'green', 'blue'];
|
|
16553
|
-
arr.slice(0); // ['red', 'green', 'blue']
|
|
16554
|
-
arr.slice(0, 2); // ['red', 'green']
|
|
16555
|
-
arr.slice(1, 100); // ['green', 'blue']
|
|
16556
|
-
```
|
|
16557
|
-
@method slice
|
|
16558
|
-
@param {Number} beginIndex (Optional) index to begin slicing from.
|
|
16559
|
-
@param {Number} endIndex (Optional) index to end the slice at (but not included).
|
|
16560
|
-
@return {Array} New array with specified slice
|
|
16561
|
-
@public
|
|
16562
|
-
*/
|
|
16563
16467
|
slice(beginIndex, endIndex) {
|
|
16564
16468
|
if (beginIndex === void 0) {
|
|
16565
16469
|
beginIndex = 0;
|
|
@@ -16589,70 +16493,10 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
16589
16493
|
return ret;
|
|
16590
16494
|
},
|
|
16591
16495
|
|
|
16592
|
-
/**
|
|
16593
|
-
Used to determine the passed object's first occurrence in the array.
|
|
16594
|
-
Returns the index if found, -1 if no match is found.
|
|
16595
|
-
The optional `startAt` argument can be used to pass a starting
|
|
16596
|
-
index to search from, effectively slicing the searchable portion
|
|
16597
|
-
of the array. If it's negative it will add the array length to
|
|
16598
|
-
the startAt value passed in as the index to search from. If less
|
|
16599
|
-
than or equal to `-1 * array.length` the entire array is searched.
|
|
16600
|
-
```javascript
|
|
16601
|
-
let arr = ['a', 'b', 'c', 'd', 'a'];
|
|
16602
|
-
arr.indexOf('a'); // 0
|
|
16603
|
-
arr.indexOf('z'); // -1
|
|
16604
|
-
arr.indexOf('a', 2); // 4
|
|
16605
|
-
arr.indexOf('a', -1); // 4, equivalent to indexOf('a', 4)
|
|
16606
|
-
arr.indexOf('a', -100); // 0, searches entire array
|
|
16607
|
-
arr.indexOf('b', 3); // -1
|
|
16608
|
-
arr.indexOf('a', 100); // -1
|
|
16609
|
-
let people = [{ name: 'Zoey' }, { name: 'Bob' }]
|
|
16610
|
-
let newPerson = { name: 'Tom' };
|
|
16611
|
-
people = [newPerson, ...people, newPerson];
|
|
16612
|
-
people.indexOf(newPerson); // 0
|
|
16613
|
-
people.indexOf(newPerson, 1); // 3
|
|
16614
|
-
people.indexOf(newPerson, -4); // 0
|
|
16615
|
-
people.indexOf(newPerson, 10); // -1
|
|
16616
|
-
```
|
|
16617
|
-
@method indexOf
|
|
16618
|
-
@param {Object} object the item to search for
|
|
16619
|
-
@param {Number} startAt optional starting location to search, default 0
|
|
16620
|
-
@return {Number} index or -1 if not found
|
|
16621
|
-
@public
|
|
16622
|
-
*/
|
|
16623
16496
|
indexOf(object, startAt) {
|
|
16624
16497
|
return indexOf(this, object, startAt, false);
|
|
16625
16498
|
},
|
|
16626
16499
|
|
|
16627
|
-
/**
|
|
16628
|
-
Returns the index of the given `object`'s last occurrence.
|
|
16629
|
-
- If no `startAt` argument is given, the search starts from
|
|
16630
|
-
the last position.
|
|
16631
|
-
- If it's greater than or equal to the length of the array,
|
|
16632
|
-
the search starts from the last position.
|
|
16633
|
-
- If it's negative, it is taken as the offset from the end
|
|
16634
|
-
of the array i.e. `startAt + array.length`.
|
|
16635
|
-
- If it's any other positive number, will search backwards
|
|
16636
|
-
from that index of the array.
|
|
16637
|
-
Returns -1 if no match is found.
|
|
16638
|
-
```javascript
|
|
16639
|
-
let arr = ['a', 'b', 'c', 'd', 'a'];
|
|
16640
|
-
arr.lastIndexOf('a'); // 4
|
|
16641
|
-
arr.lastIndexOf('z'); // -1
|
|
16642
|
-
arr.lastIndexOf('a', 2); // 0
|
|
16643
|
-
arr.lastIndexOf('a', -1); // 4
|
|
16644
|
-
arr.lastIndexOf('a', -3); // 0
|
|
16645
|
-
arr.lastIndexOf('b', 3); // 1
|
|
16646
|
-
arr.lastIndexOf('a', 100); // 4
|
|
16647
|
-
```
|
|
16648
|
-
@method lastIndexOf
|
|
16649
|
-
@param {Object} object the item to search for
|
|
16650
|
-
@param {Number} startAt optional starting location to search from
|
|
16651
|
-
backwards, defaults to `(array.length - 1)`
|
|
16652
|
-
@return {Number} The last index of the `object` in the array or -1
|
|
16653
|
-
if not found
|
|
16654
|
-
@public
|
|
16655
|
-
*/
|
|
16656
16500
|
lastIndexOf(object, startAt) {
|
|
16657
16501
|
var len = this.length;
|
|
16658
16502
|
|
|
@@ -16673,44 +16517,6 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
16673
16517
|
return -1;
|
|
16674
16518
|
},
|
|
16675
16519
|
|
|
16676
|
-
/**
|
|
16677
|
-
Iterates through the array, calling the passed function on each
|
|
16678
|
-
item. This method corresponds to the `forEach()` method defined in
|
|
16679
|
-
JavaScript 1.6.
|
|
16680
|
-
The callback method you provide should have the following signature (all
|
|
16681
|
-
parameters are optional):
|
|
16682
|
-
```javascript
|
|
16683
|
-
function(item, index, array);
|
|
16684
|
-
```
|
|
16685
|
-
- `item` is the current item in the iteration.
|
|
16686
|
-
- `index` is the current index in the iteration.
|
|
16687
|
-
- `array` is the array itself.
|
|
16688
|
-
Note that in addition to a callback, you can also pass an optional target
|
|
16689
|
-
object that will be set as `this` on the context. This is a good way
|
|
16690
|
-
to give your iterator function access to the current object.
|
|
16691
|
-
Example Usage:
|
|
16692
|
-
```javascript
|
|
16693
|
-
let foods = [
|
|
16694
|
-
{ name: 'apple', eaten: false },
|
|
16695
|
-
{ name: 'banana', eaten: false },
|
|
16696
|
-
{ name: 'carrot', eaten: false }
|
|
16697
|
-
];
|
|
16698
|
-
foods.forEach((food) => food.eaten = true);
|
|
16699
|
-
let output = '';
|
|
16700
|
-
foods.forEach((item, index, array) =>
|
|
16701
|
-
output += `${index + 1}/${array.length} ${item.name}\n`;
|
|
16702
|
-
);
|
|
16703
|
-
console.log(output);
|
|
16704
|
-
// 1/3 apple
|
|
16705
|
-
// 2/3 banana
|
|
16706
|
-
// 3/3 carrot
|
|
16707
|
-
```
|
|
16708
|
-
@method forEach
|
|
16709
|
-
@param {Function} callback The callback to execute
|
|
16710
|
-
@param {Object} [target] The target object to use
|
|
16711
|
-
@return {Object} receiver
|
|
16712
|
-
@public
|
|
16713
|
-
*/
|
|
16714
16520
|
forEach(callback, target) {
|
|
16715
16521
|
if (target === void 0) {
|
|
16716
16522
|
target = null;
|
|
@@ -16727,70 +16533,12 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
16727
16533
|
return this;
|
|
16728
16534
|
},
|
|
16729
16535
|
|
|
16730
|
-
/**
|
|
16731
|
-
Alias for `mapBy`.
|
|
16732
|
-
Returns the value of the named
|
|
16733
|
-
property on all items in the enumeration.
|
|
16734
|
-
```javascript
|
|
16735
|
-
let people = [{name: 'Joe'}, {name: 'Matt'}];
|
|
16736
|
-
people.getEach('name');
|
|
16737
|
-
// ['Joe', 'Matt'];
|
|
16738
|
-
people.getEach('nonexistentProperty');
|
|
16739
|
-
// [undefined, undefined];
|
|
16740
|
-
```
|
|
16741
|
-
@method getEach
|
|
16742
|
-
@param {String} key name of the property
|
|
16743
|
-
@return {Array} The mapped array.
|
|
16744
|
-
@public
|
|
16745
|
-
*/
|
|
16746
16536
|
getEach: mapBy,
|
|
16747
16537
|
|
|
16748
|
-
/**
|
|
16749
|
-
Sets the value on the named property for each member. This is more
|
|
16750
|
-
ergonomic than using other methods defined on this helper. If the object
|
|
16751
|
-
implements Observable, the value will be changed to `set(),` otherwise
|
|
16752
|
-
it will be set directly. `null` objects are skipped.
|
|
16753
|
-
```javascript
|
|
16754
|
-
let people = [{name: 'Joe'}, {name: 'Matt'}];
|
|
16755
|
-
people.setEach('zipCode', '10011');
|
|
16756
|
-
// [{name: 'Joe', zipCode: '10011'}, {name: 'Matt', zipCode: '10011'}];
|
|
16757
|
-
```
|
|
16758
|
-
@method setEach
|
|
16759
|
-
@param {String} key The key to set
|
|
16760
|
-
@param {Object} value The object to set
|
|
16761
|
-
@return {Object} receiver
|
|
16762
|
-
@public
|
|
16763
|
-
*/
|
|
16764
16538
|
setEach(key, value) {
|
|
16765
16539
|
return this.forEach(item => (0, _object.set)(item, key, value));
|
|
16766
16540
|
},
|
|
16767
16541
|
|
|
16768
|
-
/**
|
|
16769
|
-
Maps all of the items in the enumeration to another value, returning
|
|
16770
|
-
a new array. This method corresponds to `map()` defined in JavaScript 1.6.
|
|
16771
|
-
The callback method you provide should have the following signature (all
|
|
16772
|
-
parameters are optional):
|
|
16773
|
-
```javascript
|
|
16774
|
-
function(item, index, array);
|
|
16775
|
-
let arr = [1, 2, 3, 4, 5, 6];
|
|
16776
|
-
arr.map(element => element * element);
|
|
16777
|
-
// [1, 4, 9, 16, 25, 36];
|
|
16778
|
-
arr.map((element, index) => element + index);
|
|
16779
|
-
// [1, 3, 5, 7, 9, 11];
|
|
16780
|
-
```
|
|
16781
|
-
- `item` is the current item in the iteration.
|
|
16782
|
-
- `index` is the current index in the iteration.
|
|
16783
|
-
- `array` is the array itself.
|
|
16784
|
-
It should return the mapped value.
|
|
16785
|
-
Note that in addition to a callback, you can also pass an optional target
|
|
16786
|
-
object that will be set as `this` on the context. This is a good way
|
|
16787
|
-
to give your iterator function access to the current object.
|
|
16788
|
-
@method map
|
|
16789
|
-
@param {Function} callback The callback to execute
|
|
16790
|
-
@param {Object} [target] The target object to use
|
|
16791
|
-
@return {Array} The mapped array.
|
|
16792
|
-
@public
|
|
16793
|
-
*/
|
|
16794
16542
|
map(callback, target) {
|
|
16795
16543
|
if (target === void 0) {
|
|
16796
16544
|
target = null;
|
|
@@ -16802,67 +16550,8 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
16802
16550
|
return ret;
|
|
16803
16551
|
},
|
|
16804
16552
|
|
|
16805
|
-
/**
|
|
16806
|
-
Similar to map, this specialized function returns the value of the named
|
|
16807
|
-
property on all items in the enumeration.
|
|
16808
|
-
```javascript
|
|
16809
|
-
let people = [{name: 'Joe'}, {name: 'Matt'}];
|
|
16810
|
-
people.mapBy('name');
|
|
16811
|
-
// ['Joe', 'Matt'];
|
|
16812
|
-
people.mapBy('unknownProperty');
|
|
16813
|
-
// [undefined, undefined];
|
|
16814
|
-
```
|
|
16815
|
-
@method mapBy
|
|
16816
|
-
@param {String} key name of the property
|
|
16817
|
-
@return {Array} The mapped array.
|
|
16818
|
-
@public
|
|
16819
|
-
*/
|
|
16820
16553
|
mapBy,
|
|
16821
16554
|
|
|
16822
|
-
/**
|
|
16823
|
-
Returns a new array with all of the items in the enumeration that the provided
|
|
16824
|
-
callback function returns true for. This method corresponds to [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).
|
|
16825
|
-
The callback method should have the following signature:
|
|
16826
|
-
```javascript
|
|
16827
|
-
function(item, index, array);
|
|
16828
|
-
```
|
|
16829
|
-
- `item` is the current item in the iteration.
|
|
16830
|
-
- `index` is the current index in the iteration.
|
|
16831
|
-
- `array` is the array itself.
|
|
16832
|
-
All parameters are optional. The function should return `true` to include the item
|
|
16833
|
-
in the results, and `false` otherwise.
|
|
16834
|
-
Example:
|
|
16835
|
-
```javascript
|
|
16836
|
-
function isAdult(person) {
|
|
16837
|
-
return person.age > 18;
|
|
16838
|
-
};
|
|
16839
|
-
let people = Ember.A([{ name: 'John', age: 14 }, { name: 'Joan', age: 45 }]);
|
|
16840
|
-
people.filter(isAdult); // returns [{ name: 'Joan', age: 45 }];
|
|
16841
|
-
```
|
|
16842
|
-
Note that in addition to a callback, you can pass an optional target object
|
|
16843
|
-
that will be set as `this` on the context. This is a good way to give your
|
|
16844
|
-
iterator function access to the current object. For example:
|
|
16845
|
-
```javascript
|
|
16846
|
-
function isAdultAndEngineer(person) {
|
|
16847
|
-
return person.age > 18 && this.engineering;
|
|
16848
|
-
}
|
|
16849
|
-
class AdultsCollection {
|
|
16850
|
-
engineering = false;
|
|
16851
|
-
constructor(opts = {}) {
|
|
16852
|
-
super(...arguments);
|
|
16853
|
-
this.engineering = opts.engineering;
|
|
16854
|
-
this.people = Ember.A([{ name: 'John', age: 14 }, { name: 'Joan', age: 45 }]);
|
|
16855
|
-
}
|
|
16856
|
-
}
|
|
16857
|
-
let collection = new AdultsCollection({ engineering: true });
|
|
16858
|
-
collection.people.filter(isAdultAndEngineer, { target: collection });
|
|
16859
|
-
```
|
|
16860
|
-
@method filter
|
|
16861
|
-
@param {Function} callback The callback to execute
|
|
16862
|
-
@param {Object} [target] The target object to use
|
|
16863
|
-
@return {Array} A filtered array.
|
|
16864
|
-
@public
|
|
16865
|
-
*/
|
|
16866
16555
|
filter(callback, target) {
|
|
16867
16556
|
if (target === void 0) {
|
|
16868
16557
|
target = null;
|
|
@@ -16878,38 +16567,6 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
16878
16567
|
return ret;
|
|
16879
16568
|
},
|
|
16880
16569
|
|
|
16881
|
-
/**
|
|
16882
|
-
Returns an array with all of the items in the enumeration where the passed
|
|
16883
|
-
function returns false. This method is the inverse of filter().
|
|
16884
|
-
The callback method you provide should have the following signature (all
|
|
16885
|
-
parameters are optional):
|
|
16886
|
-
```javascript
|
|
16887
|
-
function(item, index, array);
|
|
16888
|
-
```
|
|
16889
|
-
- *item* is the current item in the iteration.
|
|
16890
|
-
- *index* is the current index in the iteration
|
|
16891
|
-
- *array* is the array itself.
|
|
16892
|
-
It should return a falsey value to include the item in the results.
|
|
16893
|
-
Note that in addition to a callback, you can also pass an optional target
|
|
16894
|
-
object that will be set as "this" on the context. This is a good way
|
|
16895
|
-
to give your iterator function access to the current object.
|
|
16896
|
-
Example Usage:
|
|
16897
|
-
```javascript
|
|
16898
|
-
const food = [
|
|
16899
|
-
{ food: 'apple', isFruit: true },
|
|
16900
|
-
{ food: 'bread', isFruit: false },
|
|
16901
|
-
{ food: 'banana', isFruit: true }
|
|
16902
|
-
];
|
|
16903
|
-
const nonFruits = food.reject(function(thing) {
|
|
16904
|
-
return thing.isFruit;
|
|
16905
|
-
}); // [{food: 'bread', isFruit: false}]
|
|
16906
|
-
```
|
|
16907
|
-
@method reject
|
|
16908
|
-
@param {Function} callback The callback to execute
|
|
16909
|
-
@param {Object} [target] The target object to use
|
|
16910
|
-
@return {Array} A rejected array.
|
|
16911
|
-
@public
|
|
16912
|
-
*/
|
|
16913
16570
|
reject(callback, target) {
|
|
16914
16571
|
if (target === void 0) {
|
|
16915
16572
|
target = null;
|
|
@@ -16922,85 +16579,16 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
16922
16579
|
});
|
|
16923
16580
|
},
|
|
16924
16581
|
|
|
16925
|
-
/**
|
|
16926
|
-
Filters the array by the property and an optional value. If a value is given, it returns
|
|
16927
|
-
the items that have said value for the property. If not, it returns all the items that
|
|
16928
|
-
have a truthy value for the property.
|
|
16929
|
-
Example Usage:
|
|
16930
|
-
```javascript
|
|
16931
|
-
let things = Ember.A([{ food: 'apple', isFruit: true }, { food: 'beans', isFruit: false }]);
|
|
16932
|
-
things.filterBy('food', 'beans'); // [{ food: 'beans', isFruit: false }]
|
|
16933
|
-
things.filterBy('isFruit'); // [{ food: 'apple', isFruit: true }]
|
|
16934
|
-
```
|
|
16935
|
-
@method filterBy
|
|
16936
|
-
@param {String} key the property to test
|
|
16937
|
-
@param {*} [value] optional value to test against.
|
|
16938
|
-
@return {Array} filtered array
|
|
16939
|
-
@public
|
|
16940
|
-
*/
|
|
16941
16582
|
filterBy() {
|
|
16942
16583
|
// @ts-expect-error TS doesn't like the ...arguments spread here.
|
|
16943
16584
|
return this.filter(iter(...arguments));
|
|
16944
16585
|
},
|
|
16945
16586
|
|
|
16946
|
-
/**
|
|
16947
|
-
Returns an array with the items that do not have truthy values for the provided key.
|
|
16948
|
-
You can pass an optional second argument with a target value to reject for the key.
|
|
16949
|
-
Otherwise this will reject objects where the provided property evaluates to false.
|
|
16950
|
-
Example Usage:
|
|
16951
|
-
```javascript
|
|
16952
|
-
let food = [
|
|
16953
|
-
{ name: "apple", isFruit: true },
|
|
16954
|
-
{ name: "carrot", isFruit: false },
|
|
16955
|
-
{ name: "bread", isFruit: false },
|
|
16956
|
-
];
|
|
16957
|
-
food.rejectBy('isFruit'); // [{ name: "carrot", isFruit: false }, { name: "bread", isFruit: false }]
|
|
16958
|
-
food.rejectBy('name', 'carrot'); // [{ name: "apple", isFruit: true }}, { name: "bread", isFruit: false }]
|
|
16959
|
-
```
|
|
16960
|
-
@method rejectBy
|
|
16961
|
-
@param {String} key the property to test
|
|
16962
|
-
@param {*} [value] optional value to test against.
|
|
16963
|
-
@return {Array} rejected array
|
|
16964
|
-
@public
|
|
16965
|
-
*/
|
|
16966
16587
|
rejectBy() {
|
|
16967
16588
|
// @ts-expect-error TS doesn't like the ...arguments spread here.
|
|
16968
16589
|
return this.reject(iter(...arguments));
|
|
16969
16590
|
},
|
|
16970
16591
|
|
|
16971
|
-
/**
|
|
16972
|
-
Returns the first item in the array for which the callback returns true.
|
|
16973
|
-
This method is similar to the `find()` method defined in ECMAScript 2015.
|
|
16974
|
-
The callback method you provide should have the following signature (all
|
|
16975
|
-
parameters are optional):
|
|
16976
|
-
```javascript
|
|
16977
|
-
function(item, index, array);
|
|
16978
|
-
```
|
|
16979
|
-
- `item` is the current item in the iteration.
|
|
16980
|
-
- `index` is the current index in the iteration.
|
|
16981
|
-
- `array` is the array itself.
|
|
16982
|
-
It should return the `true` to include the item in the results, `false`
|
|
16983
|
-
otherwise.
|
|
16984
|
-
Note that in addition to a callback, you can also pass an optional target
|
|
16985
|
-
object that will be set as `this` on the context. This is a good way
|
|
16986
|
-
to give your iterator function access to the current object.
|
|
16987
|
-
Example Usage:
|
|
16988
|
-
```javascript
|
|
16989
|
-
let users = [
|
|
16990
|
-
{ id: 1, name: 'Yehuda' },
|
|
16991
|
-
{ id: 2, name: 'Tom' },
|
|
16992
|
-
{ id: 3, name: 'Melanie' },
|
|
16993
|
-
{ id: 4, name: 'Leah' }
|
|
16994
|
-
];
|
|
16995
|
-
users.find((user) => user.name == 'Tom'); // [{ id: 2, name: 'Tom' }]
|
|
16996
|
-
users.find(({ id }) => id == 3); // [{ id: 3, name: 'Melanie' }]
|
|
16997
|
-
```
|
|
16998
|
-
@method find
|
|
16999
|
-
@param {Function} callback The callback to execute
|
|
17000
|
-
@param {Object} [target] The target object to use
|
|
17001
|
-
@return {Object} Found item or `undefined`.
|
|
17002
|
-
@public
|
|
17003
|
-
*/
|
|
17004
16592
|
find(callback, target) {
|
|
17005
16593
|
if (target === void 0) {
|
|
17006
16594
|
target = null;
|
|
@@ -17010,63 +16598,12 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17010
16598
|
return find(this, callback, target);
|
|
17011
16599
|
},
|
|
17012
16600
|
|
|
17013
|
-
/**
|
|
17014
|
-
Returns the first item with a property matching the passed value. You
|
|
17015
|
-
can pass an optional second argument with the target value. Otherwise
|
|
17016
|
-
this will match any property that evaluates to `true`.
|
|
17017
|
-
This method works much like the more generic `find()` method.
|
|
17018
|
-
Usage Example:
|
|
17019
|
-
```javascript
|
|
17020
|
-
let users = [
|
|
17021
|
-
{ id: 1, name: 'Yehuda', isTom: false },
|
|
17022
|
-
{ id: 2, name: 'Tom', isTom: true },
|
|
17023
|
-
{ id: 3, name: 'Melanie', isTom: false },
|
|
17024
|
-
{ id: 4, name: 'Leah', isTom: false }
|
|
17025
|
-
];
|
|
17026
|
-
users.findBy('id', 4); // { id: 4, name: 'Leah', isTom: false }
|
|
17027
|
-
users.findBy('name', 'Melanie'); // { id: 3, name: 'Melanie', isTom: false }
|
|
17028
|
-
users.findBy('isTom'); // { id: 2, name: 'Tom', isTom: true }
|
|
17029
|
-
```
|
|
17030
|
-
@method findBy
|
|
17031
|
-
@param {String} key the property to test
|
|
17032
|
-
@param {String} [value] optional value to test against.
|
|
17033
|
-
@return {Object} found item or `undefined`
|
|
17034
|
-
@public
|
|
17035
|
-
*/
|
|
17036
16601
|
findBy() {
|
|
17037
16602
|
// @ts-expect-error TS doesn't like the ...arguments spread here.
|
|
17038
16603
|
var callback = iter(...arguments);
|
|
17039
16604
|
return find(this, callback);
|
|
17040
16605
|
},
|
|
17041
16606
|
|
|
17042
|
-
/**
|
|
17043
|
-
Returns `true` if the passed function returns true for every item in the
|
|
17044
|
-
enumeration. This corresponds with the `Array.prototype.every()` method defined in ES5.
|
|
17045
|
-
The callback method should have the following signature:
|
|
17046
|
-
```javascript
|
|
17047
|
-
function(item, index, array);
|
|
17048
|
-
```
|
|
17049
|
-
- `item` is the current item in the iteration.
|
|
17050
|
-
- `index` is the current index in the iteration.
|
|
17051
|
-
- `array` is the array itself.
|
|
17052
|
-
All params are optional. The method should return `true` or `false`.
|
|
17053
|
-
Note that in addition to a callback, you can also pass an optional target
|
|
17054
|
-
object that will be set as `this` on the context. This is a good way
|
|
17055
|
-
to give your iterator function access to the current object.
|
|
17056
|
-
Usage example:
|
|
17057
|
-
```javascript
|
|
17058
|
-
function isAdult(person) {
|
|
17059
|
-
return person.age > 18;
|
|
17060
|
-
};
|
|
17061
|
-
const people = Ember.A([{ name: 'John', age: 24 }, { name: 'Joan', age: 45 }]);
|
|
17062
|
-
const areAllAdults = people.every(isAdult);
|
|
17063
|
-
```
|
|
17064
|
-
@method every
|
|
17065
|
-
@param {Function} callback The callback to execute
|
|
17066
|
-
@param {Object} [target] The target object to use
|
|
17067
|
-
@return {Boolean}
|
|
17068
|
-
@public
|
|
17069
|
-
*/
|
|
17070
16607
|
every(callback, target) {
|
|
17071
16608
|
if (target === void 0) {
|
|
17072
16609
|
target = null;
|
|
@@ -17076,76 +16613,12 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17076
16613
|
return every(this, callback, target);
|
|
17077
16614
|
},
|
|
17078
16615
|
|
|
17079
|
-
/**
|
|
17080
|
-
Returns `true` if the passed property resolves to the value of the second
|
|
17081
|
-
argument for all items in the array. This method is often simpler/faster
|
|
17082
|
-
than using a callback.
|
|
17083
|
-
Note that like the native `Array.every`, `isEvery` will return true when called
|
|
17084
|
-
on any empty array.
|
|
17085
|
-
```javascript
|
|
17086
|
-
class Language {
|
|
17087
|
-
constructor(name, isProgrammingLanguage) {
|
|
17088
|
-
this.name = name;
|
|
17089
|
-
this.programmingLanguage = isProgrammingLanguage;
|
|
17090
|
-
}
|
|
17091
|
-
}
|
|
17092
|
-
const compiledLanguages = [
|
|
17093
|
-
new Language('Java', true),
|
|
17094
|
-
new Language('Go', true),
|
|
17095
|
-
new Language('Rust', true)
|
|
17096
|
-
]
|
|
17097
|
-
const languagesKnownByMe = [
|
|
17098
|
-
new Language('Javascript', true),
|
|
17099
|
-
new Language('English', false),
|
|
17100
|
-
new Language('Ruby', true)
|
|
17101
|
-
]
|
|
17102
|
-
compiledLanguages.isEvery('programmingLanguage'); // true
|
|
17103
|
-
languagesKnownByMe.isEvery('programmingLanguage'); // false
|
|
17104
|
-
```
|
|
17105
|
-
@method isEvery
|
|
17106
|
-
@param {String} key the property to test
|
|
17107
|
-
@param {String} [value] optional value to test against. Defaults to `true`
|
|
17108
|
-
@return {Boolean}
|
|
17109
|
-
@since 1.3.0
|
|
17110
|
-
@public
|
|
17111
|
-
*/
|
|
17112
16616
|
isEvery() {
|
|
17113
16617
|
// @ts-expect-error TS doesn't like the ...arguments spread here.
|
|
17114
16618
|
var callback = iter(...arguments);
|
|
17115
16619
|
return every(this, callback);
|
|
17116
16620
|
},
|
|
17117
16621
|
|
|
17118
|
-
/**
|
|
17119
|
-
The any() method executes the callback function once for each element
|
|
17120
|
-
present in the array until it finds the one where callback returns a truthy
|
|
17121
|
-
value (i.e. `true`). If such an element is found, any() immediately returns
|
|
17122
|
-
true. Otherwise, any() returns false.
|
|
17123
|
-
```javascript
|
|
17124
|
-
function(item, index, array);
|
|
17125
|
-
```
|
|
17126
|
-
- `item` is the current item in the iteration.
|
|
17127
|
-
- `index` is the current index in the iteration.
|
|
17128
|
-
- `array` is the array object itself.
|
|
17129
|
-
Note that in addition to a callback, you can also pass an optional target
|
|
17130
|
-
object that will be set as `this` on the context. It can be a good way
|
|
17131
|
-
to give your iterator function access to an object in cases where an ES6
|
|
17132
|
-
arrow function would not be appropriate.
|
|
17133
|
-
Usage Example:
|
|
17134
|
-
```javascript
|
|
17135
|
-
let includesManager = people.any(this.findPersonInManagersList, this);
|
|
17136
|
-
let includesStockHolder = people.any(person => {
|
|
17137
|
-
return this.findPersonInStockHoldersList(person)
|
|
17138
|
-
});
|
|
17139
|
-
if (includesManager || includesStockHolder) {
|
|
17140
|
-
Paychecks.addBiggerBonus();
|
|
17141
|
-
}
|
|
17142
|
-
```
|
|
17143
|
-
@method any
|
|
17144
|
-
@param {Function} callback The callback to execute
|
|
17145
|
-
@param {Object} [target] The target object to use
|
|
17146
|
-
@return {Boolean} `true` if the passed function returns `true` for any item
|
|
17147
|
-
@public
|
|
17148
|
-
*/
|
|
17149
16622
|
any(callback, target) {
|
|
17150
16623
|
if (target === void 0) {
|
|
17151
16624
|
target = null;
|
|
@@ -17155,73 +16628,12 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17155
16628
|
return any(this, callback, target);
|
|
17156
16629
|
},
|
|
17157
16630
|
|
|
17158
|
-
/**
|
|
17159
|
-
Returns `true` if the passed property resolves to the value of the second
|
|
17160
|
-
argument for any item in the array. This method is often simpler/faster
|
|
17161
|
-
than using a callback.
|
|
17162
|
-
Example usage:
|
|
17163
|
-
```javascript
|
|
17164
|
-
const food = [
|
|
17165
|
-
{ food: 'apple', isFruit: true },
|
|
17166
|
-
{ food: 'bread', isFruit: false },
|
|
17167
|
-
{ food: 'banana', isFruit: true }
|
|
17168
|
-
];
|
|
17169
|
-
food.isAny('isFruit'); // true
|
|
17170
|
-
```
|
|
17171
|
-
@method isAny
|
|
17172
|
-
@param {String} key the property to test
|
|
17173
|
-
@param {String} [value] optional value to test against. Defaults to `true`
|
|
17174
|
-
@return {Boolean}
|
|
17175
|
-
@since 1.3.0
|
|
17176
|
-
@public
|
|
17177
|
-
*/
|
|
17178
16631
|
isAny() {
|
|
17179
16632
|
// @ts-expect-error TS doesn't like us using arguments like this
|
|
17180
16633
|
var callback = iter(...arguments);
|
|
17181
16634
|
return any(this, callback);
|
|
17182
16635
|
},
|
|
17183
16636
|
|
|
17184
|
-
/**
|
|
17185
|
-
This will combine the values of the array into a single value. It
|
|
17186
|
-
is a useful way to collect a summary value from an array. This
|
|
17187
|
-
corresponds to the `reduce()` method defined in JavaScript 1.8.
|
|
17188
|
-
The callback method you provide should have the following signature (all
|
|
17189
|
-
parameters are optional):
|
|
17190
|
-
```javascript
|
|
17191
|
-
function(previousValue, item, index, array);
|
|
17192
|
-
```
|
|
17193
|
-
- `previousValue` is the value returned by the last call to the iterator.
|
|
17194
|
-
- `item` is the current item in the iteration.
|
|
17195
|
-
- `index` is the current index in the iteration.
|
|
17196
|
-
- `array` is the array itself.
|
|
17197
|
-
Return the new cumulative value.
|
|
17198
|
-
In addition to the callback you can also pass an `initialValue`. An error
|
|
17199
|
-
will be raised if you do not pass an initial value and the enumerator is
|
|
17200
|
-
empty.
|
|
17201
|
-
Note that unlike the other methods, this method does not allow you to
|
|
17202
|
-
pass a target object to set as this for the callback. It's part of the
|
|
17203
|
-
spec. Sorry.
|
|
17204
|
-
Example Usage:
|
|
17205
|
-
```javascript
|
|
17206
|
-
let numbers = [1, 2, 3, 4, 5];
|
|
17207
|
-
numbers.reduce(function(summation, current) {
|
|
17208
|
-
return summation + current;
|
|
17209
|
-
}); // 15 (1 + 2 + 3 + 4 + 5)
|
|
17210
|
-
numbers.reduce(function(summation, current) {
|
|
17211
|
-
return summation + current;
|
|
17212
|
-
}, -15); // 0 (-15 + 1 + 2 + 3 + 4 + 5)
|
|
17213
|
-
|
|
17214
|
-
let binaryValues = [true, false, false];
|
|
17215
|
-
binaryValues.reduce(function(truthValue, current) {
|
|
17216
|
-
return truthValue && current;
|
|
17217
|
-
}); // false (true && false && false)
|
|
17218
|
-
```
|
|
17219
|
-
@method reduce
|
|
17220
|
-
@param {Function} callback The callback to execute
|
|
17221
|
-
@param {Object} initialValue Initial value for the reduce
|
|
17222
|
-
@return {Object} The reduced value.
|
|
17223
|
-
@public
|
|
17224
|
-
*/
|
|
17225
16637
|
// FIXME: When called without initialValue, behavior does not match native behavior
|
|
17226
16638
|
reduce(callback, initialValue) {
|
|
17227
16639
|
(true && !(typeof callback === 'function') && (0, _debug.assert)('`reduce` expects a function as first argument.', typeof callback === 'function'));
|
|
@@ -17232,30 +16644,6 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17232
16644
|
return ret;
|
|
17233
16645
|
},
|
|
17234
16646
|
|
|
17235
|
-
/**
|
|
17236
|
-
Invokes the named method on every object in the receiver that
|
|
17237
|
-
implements it. This method corresponds to the implementation in
|
|
17238
|
-
Prototype 1.6.
|
|
17239
|
-
```javascript
|
|
17240
|
-
class Person {
|
|
17241
|
-
name = null;
|
|
17242
|
-
constructor(name) {
|
|
17243
|
-
this.name = name;
|
|
17244
|
-
}
|
|
17245
|
-
greet(prefix='Hello') {
|
|
17246
|
-
return `${prefix} ${this.name}`;
|
|
17247
|
-
}
|
|
17248
|
-
}
|
|
17249
|
-
let people = [new Person('Joe'), new Person('Matt')];
|
|
17250
|
-
people.invoke('greet'); // ['Hello Joe', 'Hello Matt']
|
|
17251
|
-
people.invoke('greet', 'Bonjour'); // ['Bonjour Joe', 'Bonjour Matt']
|
|
17252
|
-
```
|
|
17253
|
-
@method invoke
|
|
17254
|
-
@param {String} methodName the name of the method
|
|
17255
|
-
@param {Object...} args optional arguments to pass as well.
|
|
17256
|
-
@return {Array} return values from calling invoke.
|
|
17257
|
-
@public
|
|
17258
|
-
*/
|
|
17259
16647
|
invoke(methodName) {
|
|
17260
16648
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
|
|
17261
16649
|
args[_key3 - 1] = arguments[_key3];
|
|
@@ -17271,80 +16659,18 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17271
16659
|
return ret;
|
|
17272
16660
|
},
|
|
17273
16661
|
|
|
17274
|
-
/**
|
|
17275
|
-
Simply converts the object into a genuine array. The order is not
|
|
17276
|
-
guaranteed. Corresponds to the method implemented by Prototype.
|
|
17277
|
-
@method toArray
|
|
17278
|
-
@return {Array} the object as an array.
|
|
17279
|
-
@public
|
|
17280
|
-
*/
|
|
17281
16662
|
toArray() {
|
|
17282
16663
|
return this.map(item => item);
|
|
17283
16664
|
},
|
|
17284
16665
|
|
|
17285
|
-
/**
|
|
17286
|
-
Returns a copy of the array with all `null` and `undefined` elements removed.
|
|
17287
|
-
```javascript
|
|
17288
|
-
let arr = ['a', null, 'c', undefined];
|
|
17289
|
-
arr.compact(); // ['a', 'c']
|
|
17290
|
-
```
|
|
17291
|
-
@method compact
|
|
17292
|
-
@return {Array} the array without null and undefined elements.
|
|
17293
|
-
@public
|
|
17294
|
-
*/
|
|
17295
16666
|
compact() {
|
|
17296
16667
|
return this.filter(value => value != null);
|
|
17297
16668
|
},
|
|
17298
16669
|
|
|
17299
|
-
/**
|
|
17300
|
-
Used to determine if the array contains the passed object.
|
|
17301
|
-
Returns `true` if found, `false` otherwise.
|
|
17302
|
-
The optional `startAt` argument can be used to pass a starting
|
|
17303
|
-
index to search from, effectively slicing the searchable portion
|
|
17304
|
-
of the array. If it's negative it will add the array length to
|
|
17305
|
-
the startAt value passed in as the index to search from. If less
|
|
17306
|
-
than or equal to `-1 * array.length` the entire array is searched.
|
|
17307
|
-
This method has the same behavior of JavaScript's [Array.includes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).
|
|
17308
|
-
```javascript
|
|
17309
|
-
[1, 2, 3].includes(2); // true
|
|
17310
|
-
[1, 2, 3].includes(4); // false
|
|
17311
|
-
[1, 2, 3].includes(3, 2); // true
|
|
17312
|
-
[1, 2, 3].includes(3, 3); // false
|
|
17313
|
-
[1, 2, 3].includes(3, -1); // true
|
|
17314
|
-
[1, 2, 3].includes(1, -1); // false
|
|
17315
|
-
[1, 2, 3].includes(1, -4); // true
|
|
17316
|
-
[1, 2, NaN].includes(NaN); // true
|
|
17317
|
-
```
|
|
17318
|
-
@method includes
|
|
17319
|
-
@param {Object} object The object to search for.
|
|
17320
|
-
@param {Number} startAt optional starting location to search, default 0
|
|
17321
|
-
@return {Boolean} `true` if object is found in the array.
|
|
17322
|
-
@public
|
|
17323
|
-
*/
|
|
17324
16670
|
includes(object, startAt) {
|
|
17325
16671
|
return indexOf(this, object, startAt, true) !== -1;
|
|
17326
16672
|
},
|
|
17327
16673
|
|
|
17328
|
-
/**
|
|
17329
|
-
Sorts the array by the keys specified in the argument.
|
|
17330
|
-
You may provide multiple arguments to sort by multiple properties.
|
|
17331
|
-
```javascript
|
|
17332
|
-
let colors = [
|
|
17333
|
-
{ name: 'red', weight: 500 },
|
|
17334
|
-
{ name: 'green', weight: 600 },
|
|
17335
|
-
{ name: 'blue', weight: 500 }
|
|
17336
|
-
];
|
|
17337
|
-
colors.sortBy('name');
|
|
17338
|
-
// [{name: 'blue', weight: 500}, {name: 'green', weight: 600}, {name: 'red', weight: 500}]
|
|
17339
|
-
colors.sortBy('weight', 'name');
|
|
17340
|
-
// [{name: 'blue', weight: 500}, {name: 'red', weight: 500}, {name: 'green', weight: 600}]
|
|
17341
|
-
```
|
|
17342
|
-
@method sortBy
|
|
17343
|
-
@param {String} property name(s) to sort on
|
|
17344
|
-
@return {Array} The sorted array.
|
|
17345
|
-
@since 1.2.0
|
|
17346
|
-
@public
|
|
17347
|
-
*/
|
|
17348
16674
|
sortBy() {
|
|
17349
16675
|
var sortKeys = arguments;
|
|
17350
16676
|
return this.toArray().sort((a, b) => {
|
|
@@ -17364,53 +16690,14 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17364
16690
|
});
|
|
17365
16691
|
},
|
|
17366
16692
|
|
|
17367
|
-
/**
|
|
17368
|
-
Returns a new array that contains only unique values. The default
|
|
17369
|
-
implementation returns an array regardless of the receiver type.
|
|
17370
|
-
```javascript
|
|
17371
|
-
let arr = ['a', 'a', 'b', 'b'];
|
|
17372
|
-
arr.uniq(); // ['a', 'b']
|
|
17373
|
-
```
|
|
17374
|
-
This only works on primitive data types, e.g. Strings, Numbers, etc.
|
|
17375
|
-
@method uniq
|
|
17376
|
-
@return {EmberArray}
|
|
17377
|
-
@public
|
|
17378
|
-
*/
|
|
17379
16693
|
uniq() {
|
|
17380
16694
|
return uniqBy(this);
|
|
17381
16695
|
},
|
|
17382
16696
|
|
|
17383
|
-
/**
|
|
17384
|
-
Returns a new array that contains only items containing a unique property value.
|
|
17385
|
-
The default implementation returns an array regardless of the receiver type.
|
|
17386
|
-
```javascript
|
|
17387
|
-
let arr = [{ value: 'a' }, { value: 'a' }, { value: 'b' }, { value: 'b' }];
|
|
17388
|
-
arr.uniqBy('value'); // [{ value: 'a' }, { value: 'b' }]
|
|
17389
|
-
let arr = [2.2, 2.1, 3.2, 3.3];
|
|
17390
|
-
arr.uniqBy(Math.floor); // [2.2, 3.2];
|
|
17391
|
-
```
|
|
17392
|
-
@method uniqBy
|
|
17393
|
-
@param {String,Function} key
|
|
17394
|
-
@return {EmberArray}
|
|
17395
|
-
@public
|
|
17396
|
-
*/
|
|
17397
16697
|
uniqBy(key) {
|
|
17398
16698
|
return uniqBy(this, key);
|
|
17399
16699
|
},
|
|
17400
16700
|
|
|
17401
|
-
/**
|
|
17402
|
-
Returns a new array that excludes the passed value. The default
|
|
17403
|
-
implementation returns an array regardless of the receiver type.
|
|
17404
|
-
If the receiver does not contain the value it returns the original array.
|
|
17405
|
-
```javascript
|
|
17406
|
-
let arr = ['a', 'b', 'a', 'c'];
|
|
17407
|
-
arr.without('a'); // ['b', 'c']
|
|
17408
|
-
```
|
|
17409
|
-
@method without
|
|
17410
|
-
@param {Object} value
|
|
17411
|
-
@return {EmberArray}
|
|
17412
|
-
@public
|
|
17413
|
-
*/
|
|
17414
16701
|
without(value) {
|
|
17415
16702
|
if (!this.includes(value)) {
|
|
17416
16703
|
return this; // nothing to do
|
|
@@ -17424,35 +16711,6 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17424
16711
|
});
|
|
17425
16712
|
|
|
17426
16713
|
var MutableArray = _mixin.default.create(EmberArray, _mutable.default, {
|
|
17427
|
-
/**
|
|
17428
|
-
__Required.__ You must implement this method to apply this mixin.
|
|
17429
|
-
This is one of the primitives you must implement to support `Array`.
|
|
17430
|
-
You should replace amt objects started at idx with the objects in the
|
|
17431
|
-
passed array.
|
|
17432
|
-
Note that this method is expected to validate the type(s) of objects that it expects.
|
|
17433
|
-
@method replace
|
|
17434
|
-
@param {Number} idx Starting index in the array to replace. If
|
|
17435
|
-
idx >= length, then append to the end of the array.
|
|
17436
|
-
@param {Number} amt Number of elements that should be removed from
|
|
17437
|
-
the array, starting at *idx*.
|
|
17438
|
-
@param {EmberArray} [objects] An optional array of zero or more objects that should be
|
|
17439
|
-
inserted into the array at *idx*
|
|
17440
|
-
@public
|
|
17441
|
-
*/
|
|
17442
|
-
|
|
17443
|
-
/**
|
|
17444
|
-
Remove all elements from the array. This is useful if you
|
|
17445
|
-
want to reuse an existing array without having to recreate it.
|
|
17446
|
-
```javascript
|
|
17447
|
-
let colors = ['red', 'green', 'blue'];
|
|
17448
|
-
colors.length; // 3
|
|
17449
|
-
colors.clear(); // []
|
|
17450
|
-
colors.length; // 0
|
|
17451
|
-
```
|
|
17452
|
-
@method clear
|
|
17453
|
-
@return {Array} An empty Array.
|
|
17454
|
-
@public
|
|
17455
|
-
*/
|
|
17456
16714
|
clear() {
|
|
17457
16715
|
var len = this.length;
|
|
17458
16716
|
|
|
@@ -17464,92 +16722,24 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17464
16722
|
return this;
|
|
17465
16723
|
},
|
|
17466
16724
|
|
|
17467
|
-
/**
|
|
17468
|
-
This will use the primitive `replace()` method to insert an object at the
|
|
17469
|
-
specified index.
|
|
17470
|
-
```javascript
|
|
17471
|
-
let colors = ['red', 'green', 'blue'];
|
|
17472
|
-
colors.insertAt(2, 'yellow'); // ['red', 'green', 'yellow', 'blue']
|
|
17473
|
-
colors.insertAt(5, 'orange'); // Error: Index out of range
|
|
17474
|
-
```
|
|
17475
|
-
@method insertAt
|
|
17476
|
-
@param {Number} idx index of insert the object at.
|
|
17477
|
-
@param {Object} object object to insert
|
|
17478
|
-
@return {EmberArray} receiver
|
|
17479
|
-
@public
|
|
17480
|
-
*/
|
|
17481
16725
|
insertAt(idx, object) {
|
|
17482
16726
|
insertAt(this, idx, object);
|
|
17483
16727
|
return this;
|
|
17484
16728
|
},
|
|
17485
16729
|
|
|
17486
|
-
/**
|
|
17487
|
-
Remove an object at the specified index using the `replace()` primitive
|
|
17488
|
-
method. You can pass either a single index, or a start and a length.
|
|
17489
|
-
If you pass a start and length that is beyond the
|
|
17490
|
-
length this method will throw an assertion.
|
|
17491
|
-
```javascript
|
|
17492
|
-
let colors = ['red', 'green', 'blue', 'yellow', 'orange'];
|
|
17493
|
-
colors.removeAt(0); // ['green', 'blue', 'yellow', 'orange']
|
|
17494
|
-
colors.removeAt(2, 2); // ['green', 'blue']
|
|
17495
|
-
colors.removeAt(4, 2); // Error: Index out of range
|
|
17496
|
-
```
|
|
17497
|
-
@method removeAt
|
|
17498
|
-
@param {Number} start index, start of range
|
|
17499
|
-
@param {Number} len length of passing range
|
|
17500
|
-
@return {EmberArray} receiver
|
|
17501
|
-
@public
|
|
17502
|
-
*/
|
|
17503
16730
|
removeAt(start, len) {
|
|
17504
16731
|
return removeAt(this, start, len);
|
|
17505
16732
|
},
|
|
17506
16733
|
|
|
17507
|
-
/**
|
|
17508
|
-
Push the object onto the end of the array. Works just like `push()` but it
|
|
17509
|
-
is KVO-compliant.
|
|
17510
|
-
```javascript
|
|
17511
|
-
let colors = ['red', 'green'];
|
|
17512
|
-
colors.pushObject('black'); // ['red', 'green', 'black']
|
|
17513
|
-
colors.pushObject(['yellow']); // ['red', 'green', ['yellow']]
|
|
17514
|
-
```
|
|
17515
|
-
@method pushObject
|
|
17516
|
-
@param {*} obj object to push
|
|
17517
|
-
@return object same object passed as a param
|
|
17518
|
-
@public
|
|
17519
|
-
*/
|
|
17520
16734
|
pushObject(obj) {
|
|
17521
16735
|
return insertAt(this, this.length, obj);
|
|
17522
16736
|
},
|
|
17523
16737
|
|
|
17524
|
-
/**
|
|
17525
|
-
Add the objects in the passed array to the end of the array. Defers
|
|
17526
|
-
notifying observers of the change until all objects are added.
|
|
17527
|
-
```javascript
|
|
17528
|
-
let colors = ['red'];
|
|
17529
|
-
colors.pushObjects(['yellow', 'orange']); // ['red', 'yellow', 'orange']
|
|
17530
|
-
```
|
|
17531
|
-
@method pushObjects
|
|
17532
|
-
@param {Array} objects the objects to add
|
|
17533
|
-
@return {MutableArray} receiver
|
|
17534
|
-
@public
|
|
17535
|
-
*/
|
|
17536
16738
|
pushObjects(objects) {
|
|
17537
16739
|
this.replace(this.length, 0, objects);
|
|
17538
16740
|
return this;
|
|
17539
16741
|
},
|
|
17540
16742
|
|
|
17541
|
-
/**
|
|
17542
|
-
Pop object from array or nil if none are left. Works just like `pop()` but
|
|
17543
|
-
it is KVO-compliant.
|
|
17544
|
-
```javascript
|
|
17545
|
-
let colors = ['red', 'green', 'blue'];
|
|
17546
|
-
colors.popObject(); // 'blue'
|
|
17547
|
-
console.log(colors); // ['red', 'green']
|
|
17548
|
-
```
|
|
17549
|
-
@method popObject
|
|
17550
|
-
@return object
|
|
17551
|
-
@public
|
|
17552
|
-
*/
|
|
17553
16743
|
popObject() {
|
|
17554
16744
|
var len = this.length;
|
|
17555
16745
|
|
|
@@ -17562,18 +16752,6 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17562
16752
|
return ret;
|
|
17563
16753
|
},
|
|
17564
16754
|
|
|
17565
|
-
/**
|
|
17566
|
-
Shift an object from start of array or nil if none are left. Works just
|
|
17567
|
-
like `shift()` but it is KVO-compliant.
|
|
17568
|
-
```javascript
|
|
17569
|
-
let colors = ['red', 'green', 'blue'];
|
|
17570
|
-
colors.shiftObject(); // 'red'
|
|
17571
|
-
console.log(colors); // ['green', 'blue']
|
|
17572
|
-
```
|
|
17573
|
-
@method shiftObject
|
|
17574
|
-
@return object
|
|
17575
|
-
@public
|
|
17576
|
-
*/
|
|
17577
16755
|
shiftObject() {
|
|
17578
16756
|
if (this.length === 0) {
|
|
17579
16757
|
return null;
|
|
@@ -17584,48 +16762,15 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17584
16762
|
return ret;
|
|
17585
16763
|
},
|
|
17586
16764
|
|
|
17587
|
-
/**
|
|
17588
|
-
Unshift an object to start of array. Works just like `unshift()` but it is
|
|
17589
|
-
KVO-compliant.
|
|
17590
|
-
```javascript
|
|
17591
|
-
let colors = ['red'];
|
|
17592
|
-
colors.unshiftObject('yellow'); // ['yellow', 'red']
|
|
17593
|
-
colors.unshiftObject(['black']); // [['black'], 'yellow', 'red']
|
|
17594
|
-
```
|
|
17595
|
-
@method unshiftObject
|
|
17596
|
-
@param {*} obj object to unshift
|
|
17597
|
-
@return object same object passed as a param
|
|
17598
|
-
@public
|
|
17599
|
-
*/
|
|
17600
16765
|
unshiftObject(obj) {
|
|
17601
16766
|
return insertAt(this, 0, obj);
|
|
17602
16767
|
},
|
|
17603
16768
|
|
|
17604
|
-
/**
|
|
17605
|
-
Adds the named objects to the beginning of the array. Defers notifying
|
|
17606
|
-
observers until all objects have been added.
|
|
17607
|
-
```javascript
|
|
17608
|
-
let colors = ['red'];
|
|
17609
|
-
colors.unshiftObjects(['black', 'white']); // ['black', 'white', 'red']
|
|
17610
|
-
colors.unshiftObjects('yellow'); // Type Error: 'undefined' is not a function
|
|
17611
|
-
```
|
|
17612
|
-
@method unshiftObjects
|
|
17613
|
-
@param {Enumerable} objects the objects to add
|
|
17614
|
-
@return {EmberArray} receiver
|
|
17615
|
-
@public
|
|
17616
|
-
*/
|
|
17617
16769
|
unshiftObjects(objects) {
|
|
17618
16770
|
this.replace(0, 0, objects);
|
|
17619
16771
|
return this;
|
|
17620
16772
|
},
|
|
17621
16773
|
|
|
17622
|
-
/**
|
|
17623
|
-
Reverse objects in the array. Works just like `reverse()` but it is
|
|
17624
|
-
KVO-compliant.
|
|
17625
|
-
@method reverseObjects
|
|
17626
|
-
@return {EmberArray} receiver
|
|
17627
|
-
@public
|
|
17628
|
-
*/
|
|
17629
16774
|
reverseObjects() {
|
|
17630
16775
|
var len = this.length;
|
|
17631
16776
|
|
|
@@ -17638,20 +16783,6 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17638
16783
|
return this;
|
|
17639
16784
|
},
|
|
17640
16785
|
|
|
17641
|
-
/**
|
|
17642
|
-
Replace all the receiver's content with content of the argument.
|
|
17643
|
-
If argument is an empty array receiver will be cleared.
|
|
17644
|
-
```javascript
|
|
17645
|
-
let colors = ['red', 'green', 'blue'];
|
|
17646
|
-
colors.setObjects(['black', 'white']); // ['black', 'white']
|
|
17647
|
-
colors.setObjects([]); // []
|
|
17648
|
-
```
|
|
17649
|
-
@method setObjects
|
|
17650
|
-
@param {EmberArray} objects array whose content will be used for replacing
|
|
17651
|
-
the content of the receiver
|
|
17652
|
-
@return {EmberArray} receiver with the new content
|
|
17653
|
-
@public
|
|
17654
|
-
*/
|
|
17655
16786
|
setObjects(objects) {
|
|
17656
16787
|
if (objects.length === 0) {
|
|
17657
16788
|
return this.clear();
|
|
@@ -17662,19 +16793,6 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17662
16793
|
return this;
|
|
17663
16794
|
},
|
|
17664
16795
|
|
|
17665
|
-
/**
|
|
17666
|
-
Remove all occurrences of an object in the array.
|
|
17667
|
-
```javascript
|
|
17668
|
-
let cities = ['Chicago', 'Berlin', 'Lima', 'Chicago'];
|
|
17669
|
-
cities.removeObject('Chicago'); // ['Berlin', 'Lima']
|
|
17670
|
-
cities.removeObject('Lima'); // ['Berlin']
|
|
17671
|
-
cities.removeObject('Tokyo') // ['Berlin']
|
|
17672
|
-
```
|
|
17673
|
-
@method removeObject
|
|
17674
|
-
@param {*} obj object to remove
|
|
17675
|
-
@return {EmberArray} receiver
|
|
17676
|
-
@public
|
|
17677
|
-
*/
|
|
17678
16796
|
removeObject(obj) {
|
|
17679
16797
|
var loc = this.length || 0;
|
|
17680
16798
|
|
|
@@ -17689,13 +16807,6 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17689
16807
|
return this;
|
|
17690
16808
|
},
|
|
17691
16809
|
|
|
17692
|
-
/**
|
|
17693
|
-
Removes each object in the passed array from the receiver.
|
|
17694
|
-
@method removeObjects
|
|
17695
|
-
@param {EmberArray} objects the objects to remove
|
|
17696
|
-
@return {EmberArray} receiver
|
|
17697
|
-
@public
|
|
17698
|
-
*/
|
|
17699
16810
|
removeObjects(objects) {
|
|
17700
16811
|
(0, _metal.beginPropertyChanges)();
|
|
17701
16812
|
|
|
@@ -17708,19 +16819,6 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17708
16819
|
return this;
|
|
17709
16820
|
},
|
|
17710
16821
|
|
|
17711
|
-
/**
|
|
17712
|
-
Push the object onto the end of the array if it is not already
|
|
17713
|
-
present in the array.
|
|
17714
|
-
```javascript
|
|
17715
|
-
let cities = ['Chicago', 'Berlin'];
|
|
17716
|
-
cities.addObject('Lima'); // ['Chicago', 'Berlin', 'Lima']
|
|
17717
|
-
cities.addObject('Berlin'); // ['Chicago', 'Berlin', 'Lima']
|
|
17718
|
-
```
|
|
17719
|
-
@method addObject
|
|
17720
|
-
@param {*} obj object to add, if not already present
|
|
17721
|
-
@return {EmberArray} receiver
|
|
17722
|
-
@public
|
|
17723
|
-
*/
|
|
17724
16822
|
addObject(obj) {
|
|
17725
16823
|
var included = this.includes(obj);
|
|
17726
16824
|
|
|
@@ -17731,13 +16829,6 @@ define("@ember/array/index", ["exports", "@ember/-internals/metal", "@ember/-int
|
|
|
17731
16829
|
return this;
|
|
17732
16830
|
},
|
|
17733
16831
|
|
|
17734
|
-
/**
|
|
17735
|
-
Adds each object in the passed array to the receiver.
|
|
17736
|
-
@method addObjects
|
|
17737
|
-
@param {EmberArray} objects the objects to add.
|
|
17738
|
-
@return {EmberArray} receiver
|
|
17739
|
-
@public
|
|
17740
|
-
*/
|
|
17741
16832
|
addObjects(objects) {
|
|
17742
16833
|
(0, _metal.beginPropertyChanges)();
|
|
17743
16834
|
objects.forEach(obj => this.addObject(obj));
|
|
@@ -17910,17 +17001,6 @@ define("@ember/array/proxy", ["exports", "@ember/-internals/metal", "@ember/obje
|
|
|
17910
17001
|
willDestroy() {
|
|
17911
17002
|
this._removeArrangedContentArrayObserver();
|
|
17912
17003
|
}
|
|
17913
|
-
/**
|
|
17914
|
-
Should actually retrieve the object at the specified index from the
|
|
17915
|
-
content. You can override this method in subclasses to transform the
|
|
17916
|
-
content item to something new.
|
|
17917
|
-
This method will only be called if content is non-`null`.
|
|
17918
|
-
@method objectAtContent
|
|
17919
|
-
@param {Number} idx The index to retrieve.
|
|
17920
|
-
@return {Object} the value or undefined if none found
|
|
17921
|
-
@public
|
|
17922
|
-
*/
|
|
17923
|
-
|
|
17924
17004
|
|
|
17925
17005
|
objectAtContent(idx) {
|
|
17926
17006
|
var arrangedContent = (0, _object.get)(this, 'arrangedContent');
|
|
@@ -17934,19 +17014,6 @@ define("@ember/array/proxy", ["exports", "@ember/-internals/metal", "@ember/obje
|
|
|
17934
17014
|
(true && !((0, _object.get)(this, 'arrangedContent') === (0, _object.get)(this, 'content')) && (0, _debug.assert)('Mutating an arranged ArrayProxy is not allowed', (0, _object.get)(this, 'arrangedContent') === (0, _object.get)(this, 'content')));
|
|
17935
17015
|
this.replaceContent(idx, amt, objects);
|
|
17936
17016
|
}
|
|
17937
|
-
/**
|
|
17938
|
-
Should actually replace the specified objects on the content array.
|
|
17939
|
-
You can override this method in subclasses to transform the content item
|
|
17940
|
-
into something new.
|
|
17941
|
-
This method will only be called if content is non-`null`.
|
|
17942
|
-
@method replaceContent
|
|
17943
|
-
@param {Number} idx The starting index
|
|
17944
|
-
@param {Number} amt The number of items to remove from the content.
|
|
17945
|
-
@param {Array} objects Optional array of objects to insert.
|
|
17946
|
-
@return {void}
|
|
17947
|
-
@public
|
|
17948
|
-
*/
|
|
17949
|
-
|
|
17950
17017
|
|
|
17951
17018
|
replaceContent(idx, amt, objects) {
|
|
17952
17019
|
var content = (0, _object.get)(this, 'content');
|
|
@@ -18115,13 +17182,6 @@ define("@ember/array/proxy", ["exports", "@ember/-internals/metal", "@ember/obje
|
|
|
18115
17182
|
}
|
|
18116
17183
|
|
|
18117
17184
|
ArrayProxy.reopen(_mutable.default, {
|
|
18118
|
-
/**
|
|
18119
|
-
The array that the proxy pretends to be. In the default `ArrayProxy`
|
|
18120
|
-
implementation, this and `content` are the same. Subclasses of `ArrayProxy`
|
|
18121
|
-
can override this property to provide things like sorting and filtering.
|
|
18122
|
-
@property arrangedContent
|
|
18123
|
-
@public
|
|
18124
|
-
*/
|
|
18125
17185
|
arrangedContent: (0, _metal.alias)('content')
|
|
18126
17186
|
});
|
|
18127
17187
|
var _default = ArrayProxy;
|
|
@@ -18307,20 +17367,6 @@ define("@ember/controller/index", ["exports", "@ember/-internals/owner", "@ember
|
|
|
18307
17367
|
/* ducktype as a controller */
|
|
18308
17368
|
isController: true,
|
|
18309
17369
|
concatenatedProperties: ['queryParams'],
|
|
18310
|
-
|
|
18311
|
-
/**
|
|
18312
|
-
The object to which actions from the view should be sent.
|
|
18313
|
-
For example, when a Handlebars template uses the `{{action}}` helper,
|
|
18314
|
-
it will attempt to send the action to the view's controller's `target`.
|
|
18315
|
-
By default, the value of the target property is set to the router, and
|
|
18316
|
-
is injected when a controller is instantiated. This injection is applied
|
|
18317
|
-
as part of the application's initialization process. In most cases the
|
|
18318
|
-
`target` property will automatically be set to the logical consumer of
|
|
18319
|
-
actions for the controller.
|
|
18320
|
-
@property target
|
|
18321
|
-
@default null
|
|
18322
|
-
@public
|
|
18323
|
-
*/
|
|
18324
17370
|
target: null,
|
|
18325
17371
|
store: null,
|
|
18326
17372
|
|
|
@@ -18335,12 +17381,6 @@ define("@ember/controller/index", ["exports", "@ember/-internals/owner", "@ember
|
|
|
18335
17381
|
}
|
|
18336
17382
|
},
|
|
18337
17383
|
|
|
18338
|
-
/**
|
|
18339
|
-
The controller's current model. When retrieving or modifying a controller's
|
|
18340
|
-
model, this property should be used instead of the `content` property.
|
|
18341
|
-
@property model
|
|
18342
|
-
@public
|
|
18343
|
-
*/
|
|
18344
17384
|
model: (0, _object.computed)({
|
|
18345
17385
|
get() {
|
|
18346
17386
|
return this[MODEL];
|
|
@@ -18351,30 +17391,6 @@ define("@ember/controller/index", ["exports", "@ember/-internals/owner", "@ember
|
|
|
18351
17391
|
}
|
|
18352
17392
|
|
|
18353
17393
|
}),
|
|
18354
|
-
|
|
18355
|
-
/**
|
|
18356
|
-
Defines which query parameters the controller accepts.
|
|
18357
|
-
If you give the names `['category','page']` it will bind
|
|
18358
|
-
the values of these query parameters to the variables
|
|
18359
|
-
`this.category` and `this.page`.
|
|
18360
|
-
By default, query parameters are parsed as strings. This
|
|
18361
|
-
may cause unexpected behavior if a query parameter is used with `toggleProperty`,
|
|
18362
|
-
because the initial value set for `param=false` will be the string `"false"`, which is truthy.
|
|
18363
|
-
To avoid this, you may specify that the query parameter should be parsed as a boolean
|
|
18364
|
-
by using the following verbose form with a `type` property:
|
|
18365
|
-
```javascript
|
|
18366
|
-
queryParams: [{
|
|
18367
|
-
category: {
|
|
18368
|
-
type: 'boolean'
|
|
18369
|
-
}
|
|
18370
|
-
}]
|
|
18371
|
-
```
|
|
18372
|
-
Available values for the `type` parameter are `'boolean'`, `'number'`, `'array'`, and `'string'`.
|
|
18373
|
-
If query param type is not specified, it will default to `'string'`.
|
|
18374
|
-
@for Ember.ControllerMixin
|
|
18375
|
-
@property queryParams
|
|
18376
|
-
@public
|
|
18377
|
-
*/
|
|
18378
17394
|
queryParams: null,
|
|
18379
17395
|
|
|
18380
17396
|
/**
|
|
@@ -18414,67 +17430,6 @@ define("@ember/controller/index", ["exports", "@ember/-internals/owner", "@ember
|
|
|
18414
17430
|
delegate(prop, value);
|
|
18415
17431
|
},
|
|
18416
17432
|
|
|
18417
|
-
/**
|
|
18418
|
-
Transition the application into another route. The route may
|
|
18419
|
-
be either a single route or route path:
|
|
18420
|
-
```javascript
|
|
18421
|
-
aController.transitionToRoute('blogPosts');
|
|
18422
|
-
aController.transitionToRoute('blogPosts.recentEntries');
|
|
18423
|
-
```
|
|
18424
|
-
Optionally supply a model for the route in question. The model
|
|
18425
|
-
will be serialized into the URL using the `serialize` hook of
|
|
18426
|
-
the route:
|
|
18427
|
-
```javascript
|
|
18428
|
-
aController.transitionToRoute('blogPost', aPost);
|
|
18429
|
-
```
|
|
18430
|
-
If a literal is passed (such as a number or a string), it will
|
|
18431
|
-
be treated as an identifier instead. In this case, the `model`
|
|
18432
|
-
hook of the route will be triggered:
|
|
18433
|
-
```javascript
|
|
18434
|
-
aController.transitionToRoute('blogPost', 1);
|
|
18435
|
-
```
|
|
18436
|
-
Multiple models will be applied last to first recursively up the
|
|
18437
|
-
route tree.
|
|
18438
|
-
```app/router.js
|
|
18439
|
-
Router.map(function() {
|
|
18440
|
-
this.route('blogPost', { path: ':blogPostId' }, function() {
|
|
18441
|
-
this.route('blogComment', { path: ':blogCommentId', resetNamespace: true });
|
|
18442
|
-
});
|
|
18443
|
-
});
|
|
18444
|
-
```
|
|
18445
|
-
```javascript
|
|
18446
|
-
aController.transitionToRoute('blogComment', aPost, aComment);
|
|
18447
|
-
aController.transitionToRoute('blogComment', 1, 13);
|
|
18448
|
-
```
|
|
18449
|
-
It is also possible to pass a URL (a string that starts with a
|
|
18450
|
-
`/`).
|
|
18451
|
-
```javascript
|
|
18452
|
-
aController.transitionToRoute('/');
|
|
18453
|
-
aController.transitionToRoute('/blog/post/1/comment/13');
|
|
18454
|
-
aController.transitionToRoute('/blog/posts?sort=title');
|
|
18455
|
-
```
|
|
18456
|
-
An options hash with a `queryParams` property may be provided as
|
|
18457
|
-
the final argument to add query parameters to the destination URL.
|
|
18458
|
-
```javascript
|
|
18459
|
-
aController.transitionToRoute('blogPost', 1, {
|
|
18460
|
-
queryParams: { showComments: 'true' }
|
|
18461
|
-
});
|
|
18462
|
-
// if you just want to transition the query parameters without changing the route
|
|
18463
|
-
aController.transitionToRoute({ queryParams: { sort: 'date' } });
|
|
18464
|
-
```
|
|
18465
|
-
See also [replaceRoute](/ember/release/classes/Ember.ControllerMixin/methods/replaceRoute?anchor=replaceRoute).
|
|
18466
|
-
@for Ember.ControllerMixin
|
|
18467
|
-
@method transitionToRoute
|
|
18468
|
-
@deprecated Use transitionTo from the Router service instead.
|
|
18469
|
-
@param {String} [name] the name of the route or a URL
|
|
18470
|
-
@param {...Object} models the model(s) or identifier(s) to be used
|
|
18471
|
-
while transitioning to the route.
|
|
18472
|
-
@param {Object} [options] optional hash with a queryParams property
|
|
18473
|
-
containing a mapping of query parameters
|
|
18474
|
-
@return {Transition} the transition object associated with this
|
|
18475
|
-
attempted transition
|
|
18476
|
-
@public
|
|
18477
|
-
*/
|
|
18478
17433
|
transitionToRoute() {
|
|
18479
17434
|
var _a;
|
|
18480
17435
|
|
|
@@ -18493,57 +17448,6 @@ define("@ember/controller/index", ["exports", "@ember/-internals/owner", "@ember
|
|
|
18493
17448
|
return method.apply(target, (0, _internals2.prefixRouteNameArg)(this, args));
|
|
18494
17449
|
},
|
|
18495
17450
|
|
|
18496
|
-
/**
|
|
18497
|
-
Transition into another route while replacing the current URL, if possible.
|
|
18498
|
-
This will replace the current history entry instead of adding a new one.
|
|
18499
|
-
Beside that, it is identical to `transitionToRoute` in all other respects.
|
|
18500
|
-
```javascript
|
|
18501
|
-
aController.replaceRoute('blogPosts');
|
|
18502
|
-
aController.replaceRoute('blogPosts.recentEntries');
|
|
18503
|
-
```
|
|
18504
|
-
Optionally supply a model for the route in question. The model
|
|
18505
|
-
will be serialized into the URL using the `serialize` hook of
|
|
18506
|
-
the route:
|
|
18507
|
-
```javascript
|
|
18508
|
-
aController.replaceRoute('blogPost', aPost);
|
|
18509
|
-
```
|
|
18510
|
-
If a literal is passed (such as a number or a string), it will
|
|
18511
|
-
be treated as an identifier instead. In this case, the `model`
|
|
18512
|
-
hook of the route will be triggered:
|
|
18513
|
-
```javascript
|
|
18514
|
-
aController.replaceRoute('blogPost', 1);
|
|
18515
|
-
```
|
|
18516
|
-
Multiple models will be applied last to first recursively up the
|
|
18517
|
-
route tree.
|
|
18518
|
-
```app/router.js
|
|
18519
|
-
Router.map(function() {
|
|
18520
|
-
this.route('blogPost', { path: ':blogPostId' }, function() {
|
|
18521
|
-
this.route('blogComment', { path: ':blogCommentId', resetNamespace: true });
|
|
18522
|
-
});
|
|
18523
|
-
});
|
|
18524
|
-
```
|
|
18525
|
-
```
|
|
18526
|
-
aController.replaceRoute('blogComment', aPost, aComment);
|
|
18527
|
-
aController.replaceRoute('blogComment', 1, 13);
|
|
18528
|
-
```
|
|
18529
|
-
It is also possible to pass a URL (a string that starts with a
|
|
18530
|
-
`/`).
|
|
18531
|
-
```javascript
|
|
18532
|
-
aController.replaceRoute('/');
|
|
18533
|
-
aController.replaceRoute('/blog/post/1/comment/13');
|
|
18534
|
-
```
|
|
18535
|
-
@for Ember.ControllerMixin
|
|
18536
|
-
@method replaceRoute
|
|
18537
|
-
@deprecated Use replaceWith from the Router service instead.
|
|
18538
|
-
@param {String} [name] the name of the route or a URL
|
|
18539
|
-
@param {...Object} models the model(s) or identifier(s) to be used
|
|
18540
|
-
while transitioning to the route.
|
|
18541
|
-
@param {Object} [options] optional hash with a queryParams property
|
|
18542
|
-
containing a mapping of query parameters
|
|
18543
|
-
@return {Transition} the transition object associated with this
|
|
18544
|
-
attempted transition
|
|
18545
|
-
@public
|
|
18546
|
-
*/
|
|
18547
17451
|
replaceRoute() {
|
|
18548
17452
|
var _a;
|
|
18549
17453
|
|
|
@@ -18681,7 +17585,7 @@ define("@ember/debug/container-debug-adapter", ["exports", "@ember/string", "@em
|
|
|
18681
17585
|
|
|
18682
17586
|
_exports.default = ContainerDebugAdapter;
|
|
18683
17587
|
});
|
|
18684
|
-
define("@ember/debug/data-adapter", ["exports", "@ember/-internals/owner", "@ember/runloop", "@ember/object", "@ember/string", "@ember/application/namespace", "@ember/array", "@glimmer/validator"], function (_exports, _owner, _runloop, _object, _string, _namespace, _array, _validator) {
|
|
17588
|
+
define("@ember/debug/data-adapter", ["exports", "@ember/-internals/owner", "@ember/runloop", "@ember/object", "@ember/string", "@ember/application/namespace", "@ember/array", "@glimmer/validator", "@ember/debug"], function (_exports, _owner, _runloop, _object, _string, _namespace, _array, _validator, _debug) {
|
|
18685
17589
|
"use strict";
|
|
18686
17590
|
|
|
18687
17591
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -18695,6 +17599,11 @@ define("@ember/debug/data-adapter", ["exports", "@ember/-internals/owner", "@emb
|
|
|
18695
17599
|
fn(item);
|
|
18696
17600
|
}
|
|
18697
17601
|
} else {
|
|
17602
|
+
// SAFETY: this cast required to work this way to interop between TS 4.8
|
|
17603
|
+
// and 4.9. When we drop support for 4.8, it will narrow correctly via the
|
|
17604
|
+
// use of the `in` operator above. (Preferably we will solve this by just
|
|
17605
|
+
// switching to require `Symbol.iterator` instead.)
|
|
17606
|
+
(0, _debug.assert)('', typeof arr.forEach === 'function');
|
|
18698
17607
|
arr.forEach(fn);
|
|
18699
17608
|
}
|
|
18700
17609
|
}
|
|
@@ -18780,7 +17689,7 @@ define("@ember/debug/data-adapter", ["exports", "@ember/-internals/owner", "@emb
|
|
|
18780
17689
|
(0, _validator.consumeTag)((0, _validator.tagFor)(records, '[]'));
|
|
18781
17690
|
|
|
18782
17691
|
if (hasBeenAccessed === true) {
|
|
18783
|
-
|
|
17692
|
+
(0, _runloop.next)(onChange);
|
|
18784
17693
|
} else {
|
|
18785
17694
|
hasBeenAccessed = true;
|
|
18786
17695
|
}
|
|
@@ -25349,58 +24258,10 @@ define("@ember/object/observable", ["exports", "@ember/-internals/meta", "@ember
|
|
|
25349
24258
|
@module @ember/object/observable
|
|
25350
24259
|
*/
|
|
25351
24260
|
var Observable = _mixin.default.create({
|
|
25352
|
-
/**
|
|
25353
|
-
Retrieves the value of a property from the object.
|
|
25354
|
-
This method is usually similar to using `object[keyName]` or `object.keyName`,
|
|
25355
|
-
however it supports both computed properties and the unknownProperty
|
|
25356
|
-
handler.
|
|
25357
|
-
Because `get` unifies the syntax for accessing all these kinds
|
|
25358
|
-
of properties, it can make many refactorings easier, such as replacing a
|
|
25359
|
-
simple property with a computed property, or vice versa.
|
|
25360
|
-
### Computed Properties
|
|
25361
|
-
Computed properties are methods defined with the `property` modifier
|
|
25362
|
-
declared at the end, such as:
|
|
25363
|
-
```javascript
|
|
25364
|
-
import { computed } from '@ember/object';
|
|
25365
|
-
fullName: computed('firstName', 'lastName', function() {
|
|
25366
|
-
return this.get('firstName') + ' ' + this.get('lastName');
|
|
25367
|
-
})
|
|
25368
|
-
```
|
|
25369
|
-
When you call `get` on a computed property, the function will be
|
|
25370
|
-
called and the return value will be returned instead of the function
|
|
25371
|
-
itself.
|
|
25372
|
-
### Unknown Properties
|
|
25373
|
-
Likewise, if you try to call `get` on a property whose value is
|
|
25374
|
-
`undefined`, the `unknownProperty()` method will be called on the object.
|
|
25375
|
-
If this method returns any value other than `undefined`, it will be returned
|
|
25376
|
-
instead. This allows you to implement "virtual" properties that are
|
|
25377
|
-
not defined upfront.
|
|
25378
|
-
@method get
|
|
25379
|
-
@param {String} keyName The property to retrieve
|
|
25380
|
-
@return {Object} The property value or undefined.
|
|
25381
|
-
@public
|
|
25382
|
-
*/
|
|
25383
24261
|
get(keyName) {
|
|
25384
24262
|
return (0, _object.get)(this, keyName);
|
|
25385
24263
|
},
|
|
25386
24264
|
|
|
25387
|
-
/**
|
|
25388
|
-
To get the values of multiple properties at once, call `getProperties`
|
|
25389
|
-
with a list of strings or an array:
|
|
25390
|
-
```javascript
|
|
25391
|
-
record.getProperties('firstName', 'lastName', 'zipCode');
|
|
25392
|
-
// { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
|
|
25393
|
-
```
|
|
25394
|
-
is equivalent to:
|
|
25395
|
-
```javascript
|
|
25396
|
-
record.getProperties(['firstName', 'lastName', 'zipCode']);
|
|
25397
|
-
// { firstName: 'John', lastName: 'Doe', zipCode: '10011' }
|
|
25398
|
-
```
|
|
25399
|
-
@method getProperties
|
|
25400
|
-
@param {String...|Array} list of keys to get
|
|
25401
|
-
@return {Object}
|
|
25402
|
-
@public
|
|
25403
|
-
*/
|
|
25404
24265
|
getProperties() {
|
|
25405
24266
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25406
24267
|
args[_key] = arguments[_key];
|
|
@@ -25409,57 +24270,10 @@ define("@ember/object/observable", ["exports", "@ember/-internals/meta", "@ember
|
|
|
25409
24270
|
return (0, _object.getProperties)(this, ...args);
|
|
25410
24271
|
},
|
|
25411
24272
|
|
|
25412
|
-
/**
|
|
25413
|
-
Sets the provided key or path to the value.
|
|
25414
|
-
```javascript
|
|
25415
|
-
record.set("key", value);
|
|
25416
|
-
```
|
|
25417
|
-
This method is generally very similar to calling `object["key"] = value` or
|
|
25418
|
-
`object.key = value`, except that it provides support for computed
|
|
25419
|
-
properties, the `setUnknownProperty()` method and property observers.
|
|
25420
|
-
### Computed Properties
|
|
25421
|
-
If you try to set a value on a key that has a computed property handler
|
|
25422
|
-
defined (see the `get()` method for an example), then `set()` will call
|
|
25423
|
-
that method, passing both the value and key instead of simply changing
|
|
25424
|
-
the value itself. This is useful for those times when you need to
|
|
25425
|
-
implement a property that is composed of one or more member
|
|
25426
|
-
properties.
|
|
25427
|
-
### Unknown Properties
|
|
25428
|
-
If you try to set a value on a key that is undefined in the target
|
|
25429
|
-
object, then the `setUnknownProperty()` handler will be called instead. This
|
|
25430
|
-
gives you an opportunity to implement complex "virtual" properties that
|
|
25431
|
-
are not predefined on the object. If `setUnknownProperty()` returns
|
|
25432
|
-
undefined, then `set()` will simply set the value on the object.
|
|
25433
|
-
### Property Observers
|
|
25434
|
-
In addition to changing the property, `set()` will also register a property
|
|
25435
|
-
change with the object. Unless you have placed this call inside of a
|
|
25436
|
-
`beginPropertyChanges()` and `endPropertyChanges(),` any "local" observers
|
|
25437
|
-
(i.e. observer methods declared on the same object), will be called
|
|
25438
|
-
immediately. Any "remote" observers (i.e. observer methods declared on
|
|
25439
|
-
another object) will be placed in a queue and called at a later time in a
|
|
25440
|
-
coalesced manner.
|
|
25441
|
-
@method set
|
|
25442
|
-
@param {String} keyName The property to set
|
|
25443
|
-
@param {Object} value The value to set or `null`.
|
|
25444
|
-
@return {Object} The passed value
|
|
25445
|
-
@public
|
|
25446
|
-
*/
|
|
25447
24273
|
set(keyName, value) {
|
|
25448
24274
|
return (0, _object.set)(this, keyName, value);
|
|
25449
24275
|
},
|
|
25450
24276
|
|
|
25451
|
-
/**
|
|
25452
|
-
Sets a list of properties at once. These properties are set inside
|
|
25453
|
-
a single `beginPropertyChanges` and `endPropertyChanges` batch, so
|
|
25454
|
-
observers will be buffered.
|
|
25455
|
-
```javascript
|
|
25456
|
-
record.setProperties({ firstName: 'Charles', lastName: 'Jolley' });
|
|
25457
|
-
```
|
|
25458
|
-
@method setProperties
|
|
25459
|
-
@param {Object} hash the hash of keys and values to set
|
|
25460
|
-
@return {Object} The passed in hash
|
|
25461
|
-
@public
|
|
25462
|
-
*/
|
|
25463
24277
|
setProperties(hash) {
|
|
25464
24278
|
return (0, _object.setProperties)(this, hash);
|
|
25465
24279
|
},
|
|
@@ -25499,104 +24313,16 @@ define("@ember/object/observable", ["exports", "@ember/-internals/meta", "@ember
|
|
|
25499
24313
|
return this;
|
|
25500
24314
|
},
|
|
25501
24315
|
|
|
25502
|
-
/**
|
|
25503
|
-
Notify the observer system that a property has just changed.
|
|
25504
|
-
Sometimes you need to change a value directly or indirectly without
|
|
25505
|
-
actually calling `get()` or `set()` on it. In this case, you can use this
|
|
25506
|
-
method instead. Calling this method will notify all observers that the
|
|
25507
|
-
property has potentially changed value.
|
|
25508
|
-
@method notifyPropertyChange
|
|
25509
|
-
@param {String} keyName The property key to be notified about.
|
|
25510
|
-
@return {Observable}
|
|
25511
|
-
@public
|
|
25512
|
-
*/
|
|
25513
24316
|
notifyPropertyChange(keyName) {
|
|
25514
24317
|
(0, _metal.notifyPropertyChange)(this, keyName);
|
|
25515
24318
|
return this;
|
|
25516
24319
|
},
|
|
25517
24320
|
|
|
25518
|
-
/**
|
|
25519
|
-
Adds an observer on a property.
|
|
25520
|
-
This is the core method used to register an observer for a property.
|
|
25521
|
-
Once you call this method, any time the key's value is set, your observer
|
|
25522
|
-
will be notified. Note that the observers are triggered any time the
|
|
25523
|
-
value is set, regardless of whether it has actually changed. Your
|
|
25524
|
-
observer should be prepared to handle that.
|
|
25525
|
-
There are two common invocation patterns for `.addObserver()`:
|
|
25526
|
-
- Passing two arguments:
|
|
25527
|
-
- the name of the property to observe (as a string)
|
|
25528
|
-
- the function to invoke (an actual function)
|
|
25529
|
-
- Passing three arguments:
|
|
25530
|
-
- the name of the property to observe (as a string)
|
|
25531
|
-
- the target object (will be used to look up and invoke a
|
|
25532
|
-
function on)
|
|
25533
|
-
- the name of the function to invoke on the target object
|
|
25534
|
-
(as a string).
|
|
25535
|
-
```app/components/my-component.js
|
|
25536
|
-
import Component from '@ember/component';
|
|
25537
|
-
export default Component.extend({
|
|
25538
|
-
init() {
|
|
25539
|
-
this._super(...arguments);
|
|
25540
|
-
// the following are equivalent:
|
|
25541
|
-
// using three arguments
|
|
25542
|
-
this.addObserver('foo', this, 'fooDidChange');
|
|
25543
|
-
// using two arguments
|
|
25544
|
-
this.addObserver('foo', (...args) => {
|
|
25545
|
-
this.fooDidChange(...args);
|
|
25546
|
-
});
|
|
25547
|
-
},
|
|
25548
|
-
fooDidChange() {
|
|
25549
|
-
// your custom logic code
|
|
25550
|
-
}
|
|
25551
|
-
});
|
|
25552
|
-
```
|
|
25553
|
-
### Observer Methods
|
|
25554
|
-
Observer methods have the following signature:
|
|
25555
|
-
```app/components/my-component.js
|
|
25556
|
-
import Component from '@ember/component';
|
|
25557
|
-
export default Component.extend({
|
|
25558
|
-
init() {
|
|
25559
|
-
this._super(...arguments);
|
|
25560
|
-
this.addObserver('foo', this, 'fooDidChange');
|
|
25561
|
-
},
|
|
25562
|
-
fooDidChange(sender, key, value, rev) {
|
|
25563
|
-
// your code
|
|
25564
|
-
}
|
|
25565
|
-
});
|
|
25566
|
-
```
|
|
25567
|
-
The `sender` is the object that changed. The `key` is the property that
|
|
25568
|
-
changes. The `value` property is currently reserved and unused. The `rev`
|
|
25569
|
-
is the last property revision of the object when it changed, which you can
|
|
25570
|
-
use to detect if the key value has really changed or not.
|
|
25571
|
-
Usually you will not need the value or revision parameters at
|
|
25572
|
-
the end. In this case, it is common to write observer methods that take
|
|
25573
|
-
only a sender and key value as parameters or, if you aren't interested in
|
|
25574
|
-
any of these values, to write an observer that has no parameters at all.
|
|
25575
|
-
@method addObserver
|
|
25576
|
-
@param {String} key The key to observe
|
|
25577
|
-
@param {Object} target The target object to invoke
|
|
25578
|
-
@param {String|Function} method The method to invoke
|
|
25579
|
-
@param {Boolean} sync Whether the observer is sync or not
|
|
25580
|
-
@return {Observable}
|
|
25581
|
-
@public
|
|
25582
|
-
*/
|
|
25583
24321
|
addObserver(key, target, method, sync) {
|
|
25584
24322
|
(0, _metal.addObserver)(this, key, target, method, sync);
|
|
25585
24323
|
return this;
|
|
25586
24324
|
},
|
|
25587
24325
|
|
|
25588
|
-
/**
|
|
25589
|
-
Remove an observer you have previously registered on this object. Pass
|
|
25590
|
-
the same key, target, and method you passed to `addObserver()` and your
|
|
25591
|
-
target will no longer receive notifications.
|
|
25592
|
-
@method removeObserver
|
|
25593
|
-
@param {String} key The key to observe
|
|
25594
|
-
@param {Object} target The target object to invoke
|
|
25595
|
-
@param {String|Function} method The method to invoke
|
|
25596
|
-
@param {Boolean} sync Whether the observer is async or not
|
|
25597
|
-
@return {Observable}
|
|
25598
|
-
@public
|
|
25599
|
-
*/
|
|
25600
24326
|
removeObserver(key, target, method, sync) {
|
|
25601
24327
|
(0, _metal.removeObserver)(this, key, target, method, sync);
|
|
25602
24328
|
return this;
|
|
@@ -25616,18 +24342,6 @@ define("@ember/object/observable", ["exports", "@ember/-internals/meta", "@ember
|
|
|
25616
24342
|
return (0, _metal.hasListeners)(this, `${key}:change`);
|
|
25617
24343
|
},
|
|
25618
24344
|
|
|
25619
|
-
/**
|
|
25620
|
-
Set the value of a property to the current value plus some amount.
|
|
25621
|
-
```javascript
|
|
25622
|
-
person.incrementProperty('age');
|
|
25623
|
-
team.incrementProperty('score', 2);
|
|
25624
|
-
```
|
|
25625
|
-
@method incrementProperty
|
|
25626
|
-
@param {String} keyName The name of the property to increment
|
|
25627
|
-
@param {Number} increment The amount to increment by. Defaults to 1
|
|
25628
|
-
@return {Number} The new property value
|
|
25629
|
-
@public
|
|
25630
|
-
*/
|
|
25631
24345
|
incrementProperty(keyName, increment) {
|
|
25632
24346
|
if (increment === void 0) {
|
|
25633
24347
|
increment = 1;
|
|
@@ -25637,18 +24351,6 @@ define("@ember/object/observable", ["exports", "@ember/-internals/meta", "@ember
|
|
|
25637
24351
|
return (0, _object.set)(this, keyName, (parseFloat((0, _object.get)(this, keyName)) || 0) + increment);
|
|
25638
24352
|
},
|
|
25639
24353
|
|
|
25640
|
-
/**
|
|
25641
|
-
Set the value of a property to the current value minus some amount.
|
|
25642
|
-
```javascript
|
|
25643
|
-
player.decrementProperty('lives');
|
|
25644
|
-
orc.decrementProperty('health', 5);
|
|
25645
|
-
```
|
|
25646
|
-
@method decrementProperty
|
|
25647
|
-
@param {String} keyName The name of the property to decrement
|
|
25648
|
-
@param {Number} decrement The amount to decrement by. Defaults to 1
|
|
25649
|
-
@return {Number} The new property value
|
|
25650
|
-
@public
|
|
25651
|
-
*/
|
|
25652
24354
|
decrementProperty(keyName, decrement) {
|
|
25653
24355
|
if (decrement === void 0) {
|
|
25654
24356
|
decrement = 1;
|
|
@@ -25658,31 +24360,10 @@ define("@ember/object/observable", ["exports", "@ember/-internals/meta", "@ember
|
|
|
25658
24360
|
return (0, _object.set)(this, keyName, ((0, _object.get)(this, keyName) || 0) - decrement);
|
|
25659
24361
|
},
|
|
25660
24362
|
|
|
25661
|
-
/**
|
|
25662
|
-
Set the value of a boolean property to the opposite of its
|
|
25663
|
-
current value.
|
|
25664
|
-
```javascript
|
|
25665
|
-
starship.toggleProperty('warpDriveEngaged');
|
|
25666
|
-
```
|
|
25667
|
-
@method toggleProperty
|
|
25668
|
-
@param {String} keyName The name of the property to toggle
|
|
25669
|
-
@return {Boolean} The new property value
|
|
25670
|
-
@public
|
|
25671
|
-
*/
|
|
25672
24363
|
toggleProperty(keyName) {
|
|
25673
24364
|
return (0, _object.set)(this, keyName, !(0, _object.get)(this, keyName));
|
|
25674
24365
|
},
|
|
25675
24366
|
|
|
25676
|
-
/**
|
|
25677
|
-
Returns the cached value of a computed property, if it exists.
|
|
25678
|
-
This allows you to inspect the value of a computed property
|
|
25679
|
-
without accidentally invoking it if it is intended to be
|
|
25680
|
-
generated lazily.
|
|
25681
|
-
@method cacheFor
|
|
25682
|
-
@param {String} keyName
|
|
25683
|
-
@return {Object} The cached value of the computed property, if any
|
|
25684
|
-
@public
|
|
25685
|
-
*/
|
|
25686
24367
|
cacheFor(keyName) {
|
|
25687
24368
|
var meta = (0, _meta.peekMeta)(this);
|
|
25688
24369
|
|
|
@@ -25753,66 +24434,15 @@ define("@ember/object/promise-proxy-mixin", ["exports", "@ember/object", "@ember
|
|
|
25753
24434
|
}
|
|
25754
24435
|
|
|
25755
24436
|
var PromiseProxyMixin = _mixin.default.create({
|
|
25756
|
-
/**
|
|
25757
|
-
If the proxied promise is rejected this will contain the reason
|
|
25758
|
-
provided.
|
|
25759
|
-
@property reason
|
|
25760
|
-
@default null
|
|
25761
|
-
@public
|
|
25762
|
-
*/
|
|
25763
24437
|
reason: null,
|
|
25764
|
-
|
|
25765
|
-
/**
|
|
25766
|
-
Once the proxied promise has settled this will become `false`.
|
|
25767
|
-
@property isPending
|
|
25768
|
-
@default true
|
|
25769
|
-
@public
|
|
25770
|
-
*/
|
|
25771
24438
|
isPending: (0, _object.computed)('isSettled', function () {
|
|
25772
24439
|
return !(0, _object.get)(this, 'isSettled');
|
|
25773
24440
|
}).readOnly(),
|
|
25774
|
-
|
|
25775
|
-
/**
|
|
25776
|
-
Once the proxied promise has settled this will become `true`.
|
|
25777
|
-
@property isSettled
|
|
25778
|
-
@default false
|
|
25779
|
-
@public
|
|
25780
|
-
*/
|
|
25781
24441
|
isSettled: (0, _object.computed)('isRejected', 'isFulfilled', function () {
|
|
25782
24442
|
return (0, _object.get)(this, 'isRejected') || (0, _object.get)(this, 'isFulfilled');
|
|
25783
24443
|
}).readOnly(),
|
|
25784
|
-
|
|
25785
|
-
/**
|
|
25786
|
-
Will become `true` if the proxied promise is rejected.
|
|
25787
|
-
@property isRejected
|
|
25788
|
-
@default false
|
|
25789
|
-
@public
|
|
25790
|
-
*/
|
|
25791
24444
|
isRejected: false,
|
|
25792
|
-
|
|
25793
|
-
/**
|
|
25794
|
-
Will become `true` if the proxied promise is fulfilled.
|
|
25795
|
-
@property isFulfilled
|
|
25796
|
-
@default false
|
|
25797
|
-
@public
|
|
25798
|
-
*/
|
|
25799
24445
|
isFulfilled: false,
|
|
25800
|
-
|
|
25801
|
-
/**
|
|
25802
|
-
The promise whose fulfillment value is being proxied by this object.
|
|
25803
|
-
This property must be specified upon creation, and should not be
|
|
25804
|
-
changed once created.
|
|
25805
|
-
Example:
|
|
25806
|
-
```javascript
|
|
25807
|
-
import ObjectProxy from '@ember/object/proxy';
|
|
25808
|
-
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
|
|
25809
|
-
ObjectProxy.extend(PromiseProxyMixin).create({
|
|
25810
|
-
promise: <thenable>
|
|
25811
|
-
});
|
|
25812
|
-
```
|
|
25813
|
-
@property promise
|
|
25814
|
-
@public
|
|
25815
|
-
*/
|
|
25816
24446
|
promise: (0, _object.computed)({
|
|
25817
24447
|
get() {
|
|
25818
24448
|
throw new _error.default("PromiseProxy's promise must be set");
|
|
@@ -25823,37 +24453,8 @@ define("@ember/object/promise-proxy-mixin", ["exports", "@ember/object", "@ember
|
|
|
25823
24453
|
}
|
|
25824
24454
|
|
|
25825
24455
|
}),
|
|
25826
|
-
|
|
25827
|
-
/**
|
|
25828
|
-
An alias to the proxied promise's `then`.
|
|
25829
|
-
See RSVP.Promise.then.
|
|
25830
|
-
@method then
|
|
25831
|
-
@param {Function} callback
|
|
25832
|
-
@return {RSVP.Promise}
|
|
25833
|
-
@public
|
|
25834
|
-
*/
|
|
25835
24456
|
then: promiseAlias('then'),
|
|
25836
|
-
|
|
25837
|
-
/**
|
|
25838
|
-
An alias to the proxied promise's `catch`.
|
|
25839
|
-
See RSVP.Promise.catch.
|
|
25840
|
-
@method catch
|
|
25841
|
-
@param {Function} callback
|
|
25842
|
-
@return {RSVP.Promise}
|
|
25843
|
-
@since 1.3.0
|
|
25844
|
-
@public
|
|
25845
|
-
*/
|
|
25846
24457
|
catch: promiseAlias('catch'),
|
|
25847
|
-
|
|
25848
|
-
/**
|
|
25849
|
-
An alias to the proxied promise's `finally`.
|
|
25850
|
-
See RSVP.Promise.finally.
|
|
25851
|
-
@method finally
|
|
25852
|
-
@param {Function} callback
|
|
25853
|
-
@return {RSVP.Promise}
|
|
25854
|
-
@since 1.3.0
|
|
25855
|
-
@public
|
|
25856
|
-
*/
|
|
25857
24458
|
finally: promiseAlias('finally')
|
|
25858
24459
|
});
|
|
25859
24460
|
|
|
@@ -28310,7 +26911,7 @@ define("@ember/routing/route", ["exports", "@ember/-internals/container", "@embe
|
|
|
28310
26911
|
var [name] = params;
|
|
28311
26912
|
(true && !(name) && (0, _debug.assert)('has name', name));
|
|
28312
26913
|
|
|
28313
|
-
if (name in model) {
|
|
26914
|
+
if (typeof model === 'object' && name in model) {
|
|
28314
26915
|
object[name] = (0, _object.get)(model, name);
|
|
28315
26916
|
} else if (/_id$/.test(name)) {
|
|
28316
26917
|
object[name] = (0, _object.get)(model, 'id');
|
|
@@ -53111,7 +51712,7 @@ define("ember/version", ["exports"], function (_exports) {
|
|
|
53111
51712
|
value: true
|
|
53112
51713
|
});
|
|
53113
51714
|
_exports.default = void 0;
|
|
53114
|
-
var _default = "4.9.0-alpha.
|
|
51715
|
+
var _default = "4.9.0-alpha.4";
|
|
53115
51716
|
_exports.default = _default;
|
|
53116
51717
|
});
|
|
53117
51718
|
define("route-recognizer", ["exports"], function (_exports) {
|