ember-source 4.6.0-alpha.2 → 4.6.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-metadata.json +3 -3
- package/dist/ember-template-compiler.js +2 -2
- package/dist/ember-template-compiler.map +1 -1
- package/dist/ember-testing.js +110 -129
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +465 -525
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/error-handling/index.js +1 -1
- package/dist/packages/@ember/-internals/metal/index.js +16 -6
- package/dist/packages/@ember/-internals/runtime/lib/compare.js +4 -3
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +281 -368
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -5
- package/dist/packages/@ember/application/lib/application.js +4 -1
- package/dist/packages/@ember/engine/index.js +3 -1
- package/dist/packages/@ember/object/index.js +16 -8
- package/dist/packages/@ember/object/lib/computed/reduce_computed_macros.js +1 -1
- package/dist/packages/@ember/test/adapter.js +2 -2
- package/dist/packages/ember/version.js +1 -1
- package/dist/packages/ember-testing/lib/adapters/adapter.js +9 -20
- package/dist/packages/ember-testing/lib/adapters/qunit.js +8 -16
- package/dist/packages/ember-testing/lib/ext/application.js +28 -19
- package/dist/packages/ember-testing/lib/helpers/and_then.js +4 -1
- package/dist/packages/ember-testing/lib/helpers/current_path.js +5 -0
- package/dist/packages/ember-testing/lib/helpers/current_route_name.js +5 -0
- package/dist/packages/ember-testing/lib/helpers/current_url.js +8 -1
- package/dist/packages/ember-testing/lib/helpers/visit.js +12 -2
- package/dist/packages/ember-testing/lib/helpers/wait.js +6 -1
- package/dist/packages/ember-testing/lib/initializers.js +3 -3
- package/dist/packages/ember-testing/lib/test/adapter.js +2 -1
- package/dist/packages/ember-testing/lib/test/helpers.js +3 -1
- package/dist/packages/ember-testing/lib/test/on_inject_helpers.js +2 -2
- package/dist/packages/ember-testing/lib/test/promise.js +8 -8
- package/dist/packages/ember-testing/lib/test/waiters.js +14 -45
- package/dist/packages/ember-testing/lib/test.js +1 -1
- package/docs/data.json +268 -258
- package/package.json +3 -3
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.6.0-alpha.
|
|
9
|
+
* @version 4.6.0-alpha.3
|
|
10
10
|
*/
|
|
11
11
|
/* eslint-disable no-var */
|
|
12
12
|
|
|
@@ -1390,7 +1390,7 @@ define("@ember/-internals/error-handling/index", ["exports"], function (_exports
|
|
|
1390
1390
|
onerror = handler;
|
|
1391
1391
|
}
|
|
1392
1392
|
|
|
1393
|
-
var dispatchOverride; // allows testing adapter to override dispatch
|
|
1393
|
+
var dispatchOverride = null; // allows testing adapter to override dispatch
|
|
1394
1394
|
|
|
1395
1395
|
function getDispatchOverride() {
|
|
1396
1396
|
return dispatchOverride;
|
|
@@ -9588,6 +9588,12 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
9588
9588
|
} else {
|
|
9589
9589
|
return array.objectAt(index);
|
|
9590
9590
|
}
|
|
9591
|
+
} // Ideally, we'd use MutableArray.detect but for unknown reasons this causes
|
|
9592
|
+
// the node tests to fail strangely.
|
|
9593
|
+
|
|
9594
|
+
|
|
9595
|
+
function isMutableArray(obj) {
|
|
9596
|
+
return obj != null && typeof obj.replace === 'function';
|
|
9591
9597
|
}
|
|
9592
9598
|
|
|
9593
9599
|
function replace(array, start, deleteCount, items) {
|
|
@@ -9595,10 +9601,11 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
9595
9601
|
items = EMPTY_ARRAY;
|
|
9596
9602
|
}
|
|
9597
9603
|
|
|
9598
|
-
if (
|
|
9599
|
-
replaceInNativeArray(array, start, deleteCount, items);
|
|
9600
|
-
} else {
|
|
9604
|
+
if (isMutableArray(array)) {
|
|
9601
9605
|
array.replace(start, deleteCount, items);
|
|
9606
|
+
} else {
|
|
9607
|
+
(true && !(Array.isArray(array)) && (0, _debug.assert)('Can only replace content of a native array or MutableArray', Array.isArray(array)));
|
|
9608
|
+
replaceInNativeArray(array, start, deleteCount, items);
|
|
9602
9609
|
}
|
|
9603
9610
|
}
|
|
9604
9611
|
|
|
@@ -12234,7 +12241,10 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
12234
12241
|
|
|
12235
12242
|
|
|
12236
12243
|
keys() {
|
|
12237
|
-
|
|
12244
|
+
var keys = _keys(this);
|
|
12245
|
+
|
|
12246
|
+
(true && !(keys) && (0, _debug.assert)('[BUG] Missing keys for mixin!', keys));
|
|
12247
|
+
return keys;
|
|
12238
12248
|
}
|
|
12239
12249
|
/** @internal */
|
|
12240
12250
|
|
|
@@ -12328,8 +12338,8 @@ define("@ember/-internals/metal/index", ["exports", "@ember/-internals/meta", "@
|
|
|
12328
12338
|
if (mixin.properties) {
|
|
12329
12339
|
var props = Object.keys(mixin.properties);
|
|
12330
12340
|
|
|
12331
|
-
for (var
|
|
12332
|
-
ret.add(
|
|
12341
|
+
for (var prop of props) {
|
|
12342
|
+
ret.add(prop);
|
|
12333
12343
|
}
|
|
12334
12344
|
} else if (mixin.mixins) {
|
|
12335
12345
|
mixin.mixins.forEach(x => _keys(x, ret, seen));
|
|
@@ -19531,9 +19541,10 @@ define("@ember/-internals/runtime/lib/compare", ["exports", "@ember/-internals/r
|
|
|
19531
19541
|
// SSt `------'`
|
|
19532
19542
|
|
|
19533
19543
|
function spaceship(a, b) {
|
|
19534
|
-
|
|
19535
|
-
|
|
19536
|
-
|
|
19544
|
+
// SAFETY: `Math.sign` always returns `-1` for negative, `0` for zero, and `1`
|
|
19545
|
+
// for positive numbers. (The extra precision is useful for the way we use
|
|
19546
|
+
// this in the context of `compare`.)
|
|
19547
|
+
return Math.sign(a - b);
|
|
19537
19548
|
}
|
|
19538
19549
|
/**
|
|
19539
19550
|
@module @ember/utils
|
|
@@ -20121,15 +20132,15 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20121
20132
|
|
|
20122
20133
|
var identityFunction = item => item;
|
|
20123
20134
|
|
|
20124
|
-
function uniqBy(array,
|
|
20125
|
-
if (
|
|
20126
|
-
|
|
20135
|
+
function uniqBy(array, keyOrFunc) {
|
|
20136
|
+
if (keyOrFunc === void 0) {
|
|
20137
|
+
keyOrFunc = identityFunction;
|
|
20127
20138
|
}
|
|
20128
20139
|
|
|
20129
20140
|
(true && !(isArray(array)) && (0, _debug.assert)(`first argument passed to \`uniqBy\` should be array`, isArray(array)));
|
|
20130
20141
|
var ret = A();
|
|
20131
20142
|
var seen = new Set();
|
|
20132
|
-
var getter = typeof
|
|
20143
|
+
var getter = typeof keyOrFunc === 'function' ? keyOrFunc : item => (0, _metal.get)(item, keyOrFunc);
|
|
20133
20144
|
array.forEach(item => {
|
|
20134
20145
|
var val = getter(item);
|
|
20135
20146
|
|
|
@@ -20141,8 +20152,13 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20141
20152
|
return ret;
|
|
20142
20153
|
}
|
|
20143
20154
|
|
|
20144
|
-
function iter(
|
|
20145
|
-
var
|
|
20155
|
+
function iter() {
|
|
20156
|
+
for (var _len = arguments.length, args = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
|
|
20157
|
+
args[_key2] = arguments[_key2];
|
|
20158
|
+
}
|
|
20159
|
+
|
|
20160
|
+
var valueProvided = args.length === 2;
|
|
20161
|
+
var [key, value] = args;
|
|
20146
20162
|
return valueProvided ? item => value === (0, _metal.get)(item, key) : item => Boolean((0, _metal.get)(item, key));
|
|
20147
20163
|
}
|
|
20148
20164
|
|
|
@@ -20150,6 +20166,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20150
20166
|
var len = array.length;
|
|
20151
20167
|
|
|
20152
20168
|
for (var index = startAt; index < len; index++) {
|
|
20169
|
+
// SAFETY: Because we're checking the index this value should always be set.
|
|
20153
20170
|
var item = (0, _metal.objectAt)(array, index);
|
|
20154
20171
|
|
|
20155
20172
|
if (predicate(item, index, array)) {
|
|
@@ -20161,17 +20178,29 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20161
20178
|
}
|
|
20162
20179
|
|
|
20163
20180
|
function find(array, callback, target) {
|
|
20181
|
+
if (target === void 0) {
|
|
20182
|
+
target = null;
|
|
20183
|
+
}
|
|
20184
|
+
|
|
20164
20185
|
var predicate = callback.bind(target);
|
|
20165
20186
|
var index = findIndex(array, predicate, 0);
|
|
20166
20187
|
return index === -1 ? undefined : (0, _metal.objectAt)(array, index);
|
|
20167
20188
|
}
|
|
20168
20189
|
|
|
20169
20190
|
function any(array, callback, target) {
|
|
20191
|
+
if (target === void 0) {
|
|
20192
|
+
target = null;
|
|
20193
|
+
}
|
|
20194
|
+
|
|
20170
20195
|
var predicate = callback.bind(target);
|
|
20171
20196
|
return findIndex(array, predicate, 0) !== -1;
|
|
20172
20197
|
}
|
|
20173
20198
|
|
|
20174
20199
|
function every(array, callback, target) {
|
|
20200
|
+
if (target === void 0) {
|
|
20201
|
+
target = null;
|
|
20202
|
+
}
|
|
20203
|
+
|
|
20175
20204
|
var cb = callback.bind(target);
|
|
20176
20205
|
|
|
20177
20206
|
var predicate = (item, index, array) => !cb(item, index, array);
|
|
@@ -20196,12 +20225,8 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20196
20225
|
}
|
|
20197
20226
|
|
|
20198
20227
|
function removeAt(array, index, len) {
|
|
20199
|
-
if (len === void 0) {
|
|
20200
|
-
len = 1;
|
|
20201
|
-
}
|
|
20202
|
-
|
|
20203
20228
|
(true && !(index > -1 && index < array.length) && (0, _debug.assert)(`\`removeAt\` index provided is out of range`, index > -1 && index < array.length));
|
|
20204
|
-
(0, _metal.replace)(array, index, len, EMPTY_ARRAY);
|
|
20229
|
+
(0, _metal.replace)(array, index, len !== null && len !== void 0 ? len : 1, EMPTY_ARRAY);
|
|
20205
20230
|
return array;
|
|
20206
20231
|
}
|
|
20207
20232
|
|
|
@@ -20240,24 +20265,24 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20240
20265
|
*/
|
|
20241
20266
|
|
|
20242
20267
|
|
|
20243
|
-
function isArray(
|
|
20244
|
-
var obj = _obj;
|
|
20245
|
-
|
|
20268
|
+
function isArray(obj) {
|
|
20246
20269
|
if (true
|
|
20247
20270
|
/* DEBUG */
|
|
20248
|
-
&& typeof
|
|
20249
|
-
|
|
20271
|
+
&& typeof obj === 'object' && obj !== null) {
|
|
20272
|
+
// SAFETY: Property read checks are safe if it's an object
|
|
20273
|
+
var possibleProxyContent = obj[_metal.PROXY_CONTENT];
|
|
20250
20274
|
|
|
20251
20275
|
if (possibleProxyContent !== undefined) {
|
|
20252
20276
|
obj = possibleProxyContent;
|
|
20253
20277
|
}
|
|
20254
|
-
}
|
|
20278
|
+
} // SAFETY: Property read checks are safe if it's an object
|
|
20279
|
+
|
|
20255
20280
|
|
|
20256
20281
|
if (!obj || obj.setInterval) {
|
|
20257
20282
|
return false;
|
|
20258
20283
|
}
|
|
20259
20284
|
|
|
20260
|
-
if (Array.isArray(obj) ||
|
|
20285
|
+
if (Array.isArray(obj) || EmberArray.detect(obj)) {
|
|
20261
20286
|
return true;
|
|
20262
20287
|
}
|
|
20263
20288
|
|
|
@@ -20265,7 +20290,8 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20265
20290
|
|
|
20266
20291
|
if ('array' === type) {
|
|
20267
20292
|
return true;
|
|
20268
|
-
}
|
|
20293
|
+
} // SAFETY: Property read checks are safe if it's an object
|
|
20294
|
+
|
|
20269
20295
|
|
|
20270
20296
|
var length = obj.length;
|
|
20271
20297
|
|
|
@@ -20283,54 +20309,17 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20283
20309
|
*/
|
|
20284
20310
|
|
|
20285
20311
|
|
|
20286
|
-
function nonEnumerableComputed() {
|
|
20287
|
-
var property = (0, _metal.computed)(
|
|
20312
|
+
function nonEnumerableComputed(callback) {
|
|
20313
|
+
var property = (0, _metal.computed)(callback);
|
|
20288
20314
|
property.enumerable = false;
|
|
20289
20315
|
return property;
|
|
20290
20316
|
}
|
|
20291
20317
|
|
|
20292
20318
|
function mapBy(key) {
|
|
20293
20319
|
return this.map(next => (0, _metal.get)(next, key));
|
|
20294
|
-
}
|
|
20295
|
-
// ARRAY
|
|
20296
|
-
//
|
|
20297
|
-
|
|
20298
|
-
/**
|
|
20299
|
-
This mixin implements Observer-friendly Array-like behavior. It is not a
|
|
20300
|
-
concrete implementation, but it can be used up by other classes that want
|
|
20301
|
-
to appear like arrays.
|
|
20302
|
-
|
|
20303
|
-
For example, ArrayProxy is a concrete class that can be instantiated to
|
|
20304
|
-
implement array-like behavior. This class uses the Array Mixin by way of
|
|
20305
|
-
the MutableArray mixin, which allows observable changes to be made to the
|
|
20306
|
-
underlying array.
|
|
20307
|
-
|
|
20308
|
-
This mixin defines methods specifically for collections that provide
|
|
20309
|
-
index-ordered access to their contents. When you are designing code that
|
|
20310
|
-
needs to accept any kind of Array-like object, you should use these methods
|
|
20311
|
-
instead of Array primitives because these will properly notify observers of
|
|
20312
|
-
changes to the array.
|
|
20313
|
-
|
|
20314
|
-
Although these methods are efficient, they do add a layer of indirection to
|
|
20315
|
-
your application so it is a good idea to use them only when you need the
|
|
20316
|
-
flexibility of using both true JavaScript arrays and "virtual" arrays such
|
|
20317
|
-
as controllers and collections.
|
|
20318
|
-
|
|
20319
|
-
You can use the methods defined in this module to access and modify array
|
|
20320
|
-
contents in an observable-friendly way. You can also be notified whenever
|
|
20321
|
-
the membership of an array changes by using `.observes('myArray.[]')`.
|
|
20322
|
-
|
|
20323
|
-
To support `EmberArray` in your own class, you must override two
|
|
20324
|
-
primitives to use it: `length()` and `objectAt()`.
|
|
20325
|
-
|
|
20326
|
-
@class EmberArray
|
|
20327
|
-
@uses Enumerable
|
|
20328
|
-
@since Ember 0.9.0
|
|
20329
|
-
@public
|
|
20330
|
-
*/
|
|
20331
|
-
|
|
20320
|
+
}
|
|
20332
20321
|
|
|
20333
|
-
var
|
|
20322
|
+
var EmberArray = _metal.Mixin.create(_enumerable.default, {
|
|
20334
20323
|
init() {
|
|
20335
20324
|
this._super(...arguments);
|
|
20336
20325
|
|
|
@@ -20339,28 +20328,28 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20339
20328
|
|
|
20340
20329
|
/**
|
|
20341
20330
|
__Required.__ You must implement this method to apply this mixin.
|
|
20342
|
-
|
|
20331
|
+
Your array must support the `length` property. Your replace methods should
|
|
20343
20332
|
set this property whenever it changes.
|
|
20344
|
-
|
|
20333
|
+
@property {Number} length
|
|
20345
20334
|
@public
|
|
20346
20335
|
*/
|
|
20347
20336
|
|
|
20348
20337
|
/**
|
|
20349
20338
|
Returns the object at the given `index`. If the given `index` is negative
|
|
20350
20339
|
or is greater or equal than the array length, returns `undefined`.
|
|
20351
|
-
|
|
20340
|
+
This is one of the primitives you must implement to support `EmberArray`.
|
|
20352
20341
|
If your object supports retrieving the value of an array item using `get()`
|
|
20353
20342
|
(i.e. `myArray.get(0)`), then you do not need to implement this method
|
|
20354
20343
|
yourself.
|
|
20355
|
-
|
|
20344
|
+
```javascript
|
|
20356
20345
|
let arr = ['a', 'b', 'c', 'd'];
|
|
20357
|
-
|
|
20346
|
+
arr.objectAt(0); // 'a'
|
|
20358
20347
|
arr.objectAt(3); // 'd'
|
|
20359
20348
|
arr.objectAt(-1); // undefined
|
|
20360
20349
|
arr.objectAt(4); // undefined
|
|
20361
20350
|
arr.objectAt(5); // undefined
|
|
20362
20351
|
```
|
|
20363
|
-
|
|
20352
|
+
@method objectAt
|
|
20364
20353
|
@param {Number} idx The index of the item to return.
|
|
20365
20354
|
@return {*} item at index or undefined
|
|
20366
20355
|
@public
|
|
@@ -20368,12 +20357,12 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20368
20357
|
|
|
20369
20358
|
/**
|
|
20370
20359
|
This returns the objects at the specified indexes, using `objectAt`.
|
|
20371
|
-
|
|
20360
|
+
```javascript
|
|
20372
20361
|
let arr = ['a', 'b', 'c', 'd'];
|
|
20373
|
-
|
|
20362
|
+
arr.objectsAt([0, 1, 2]); // ['a', 'b', 'c']
|
|
20374
20363
|
arr.objectsAt([2, 3, 4]); // ['c', 'd', undefined]
|
|
20375
20364
|
```
|
|
20376
|
-
|
|
20365
|
+
@method objectsAt
|
|
20377
20366
|
@param {Array} indexes An array of indexes of items to return.
|
|
20378
20367
|
@return {Array}
|
|
20379
20368
|
@public
|
|
@@ -20386,13 +20375,13 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20386
20375
|
This is the handler for the special array content property. If you get
|
|
20387
20376
|
this property, it will return this. If you set this property to a new
|
|
20388
20377
|
array, it will replace the current content.
|
|
20389
|
-
|
|
20378
|
+
```javascript
|
|
20390
20379
|
let peopleToMoon = ['Armstrong', 'Aldrin'];
|
|
20391
|
-
|
|
20392
|
-
|
|
20380
|
+
peopleToMoon.get('[]'); // ['Armstrong', 'Aldrin']
|
|
20381
|
+
peopleToMoon.set('[]', ['Collins']); // ['Collins']
|
|
20393
20382
|
peopleToMoon.get('[]'); // ['Collins']
|
|
20394
20383
|
```
|
|
20395
|
-
|
|
20384
|
+
@property []
|
|
20396
20385
|
@return this
|
|
20397
20386
|
@public
|
|
20398
20387
|
*/
|
|
@@ -20401,7 +20390,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20401
20390
|
return this;
|
|
20402
20391
|
},
|
|
20403
20392
|
|
|
20404
|
-
set(
|
|
20393
|
+
set(_key, value) {
|
|
20405
20394
|
this.replace(0, this.length, value);
|
|
20406
20395
|
return this;
|
|
20407
20396
|
}
|
|
@@ -20410,17 +20399,17 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20410
20399
|
|
|
20411
20400
|
/**
|
|
20412
20401
|
The first object in the array, or `undefined` if the array is empty.
|
|
20413
|
-
|
|
20402
|
+
```javascript
|
|
20414
20403
|
let vowels = ['a', 'e', 'i', 'o', 'u'];
|
|
20415
20404
|
vowels.firstObject; // 'a'
|
|
20416
|
-
|
|
20405
|
+
vowels.shiftObject();
|
|
20417
20406
|
vowels.firstObject; // 'e'
|
|
20418
|
-
|
|
20407
|
+
vowels.reverseObjects();
|
|
20419
20408
|
vowels.firstObject; // 'u'
|
|
20420
|
-
|
|
20409
|
+
vowels.clear();
|
|
20421
20410
|
vowels.firstObject; // undefined
|
|
20422
20411
|
```
|
|
20423
|
-
|
|
20412
|
+
@property firstObject
|
|
20424
20413
|
@return {Object | undefined} The first object in the array
|
|
20425
20414
|
@public
|
|
20426
20415
|
*/
|
|
@@ -20430,7 +20419,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20430
20419
|
|
|
20431
20420
|
/**
|
|
20432
20421
|
The last object in the array, or `undefined` if the array is empty.
|
|
20433
|
-
|
|
20422
|
+
@property lastObject
|
|
20434
20423
|
@return {Object | undefined} The last object in the array
|
|
20435
20424
|
@public
|
|
20436
20425
|
*/
|
|
@@ -20444,13 +20433,13 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20444
20433
|
Returns a new array that is a slice of the receiver. This implementation
|
|
20445
20434
|
uses the observable array methods to retrieve the objects for the new
|
|
20446
20435
|
slice.
|
|
20447
|
-
|
|
20436
|
+
```javascript
|
|
20448
20437
|
let arr = ['red', 'green', 'blue'];
|
|
20449
|
-
|
|
20438
|
+
arr.slice(0); // ['red', 'green', 'blue']
|
|
20450
20439
|
arr.slice(0, 2); // ['red', 'green']
|
|
20451
20440
|
arr.slice(1, 100); // ['green', 'blue']
|
|
20452
20441
|
```
|
|
20453
|
-
|
|
20442
|
+
@method slice
|
|
20454
20443
|
@param {Number} beginIndex (Optional) index to begin slicing from.
|
|
20455
20444
|
@param {Number} endIndex (Optional) index to end the slice at (but not included).
|
|
20456
20445
|
@return {Array} New array with specified slice
|
|
@@ -20468,13 +20457,17 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20468
20457
|
beginIndex = length + beginIndex;
|
|
20469
20458
|
}
|
|
20470
20459
|
|
|
20460
|
+
var validatedEndIndex;
|
|
20461
|
+
|
|
20471
20462
|
if (endIndex === undefined || endIndex > length) {
|
|
20472
|
-
|
|
20463
|
+
validatedEndIndex = length;
|
|
20473
20464
|
} else if (endIndex < 0) {
|
|
20474
|
-
|
|
20465
|
+
validatedEndIndex = length + endIndex;
|
|
20466
|
+
} else {
|
|
20467
|
+
validatedEndIndex = endIndex;
|
|
20475
20468
|
}
|
|
20476
20469
|
|
|
20477
|
-
while (beginIndex <
|
|
20470
|
+
while (beginIndex < validatedEndIndex) {
|
|
20478
20471
|
ret[ret.length] = (0, _metal.objectAt)(this, beginIndex++);
|
|
20479
20472
|
}
|
|
20480
20473
|
|
|
@@ -20484,29 +20477,29 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20484
20477
|
/**
|
|
20485
20478
|
Used to determine the passed object's first occurrence in the array.
|
|
20486
20479
|
Returns the index if found, -1 if no match is found.
|
|
20487
|
-
|
|
20480
|
+
The optional `startAt` argument can be used to pass a starting
|
|
20488
20481
|
index to search from, effectively slicing the searchable portion
|
|
20489
20482
|
of the array. If it's negative it will add the array length to
|
|
20490
20483
|
the startAt value passed in as the index to search from. If less
|
|
20491
20484
|
than or equal to `-1 * array.length` the entire array is searched.
|
|
20492
|
-
|
|
20485
|
+
```javascript
|
|
20493
20486
|
let arr = ['a', 'b', 'c', 'd', 'a'];
|
|
20494
|
-
|
|
20487
|
+
arr.indexOf('a'); // 0
|
|
20495
20488
|
arr.indexOf('z'); // -1
|
|
20496
20489
|
arr.indexOf('a', 2); // 4
|
|
20497
20490
|
arr.indexOf('a', -1); // 4, equivalent to indexOf('a', 4)
|
|
20498
20491
|
arr.indexOf('a', -100); // 0, searches entire array
|
|
20499
20492
|
arr.indexOf('b', 3); // -1
|
|
20500
20493
|
arr.indexOf('a', 100); // -1
|
|
20501
|
-
|
|
20494
|
+
let people = [{ name: 'Zoey' }, { name: 'Bob' }]
|
|
20502
20495
|
let newPerson = { name: 'Tom' };
|
|
20503
20496
|
people = [newPerson, ...people, newPerson];
|
|
20504
|
-
|
|
20497
|
+
people.indexOf(newPerson); // 0
|
|
20505
20498
|
people.indexOf(newPerson, 1); // 3
|
|
20506
20499
|
people.indexOf(newPerson, -4); // 0
|
|
20507
20500
|
people.indexOf(newPerson, 10); // -1
|
|
20508
20501
|
```
|
|
20509
|
-
|
|
20502
|
+
@method indexOf
|
|
20510
20503
|
@param {Object} object the item to search for
|
|
20511
20504
|
@param {Number} startAt optional starting location to search, default 0
|
|
20512
20505
|
@return {Number} index or -1 if not found
|
|
@@ -20518,7 +20511,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20518
20511
|
|
|
20519
20512
|
/**
|
|
20520
20513
|
Returns the index of the given `object`'s last occurrence.
|
|
20521
|
-
|
|
20514
|
+
- If no `startAt` argument is given, the search starts from
|
|
20522
20515
|
the last position.
|
|
20523
20516
|
- If it's greater than or equal to the length of the array,
|
|
20524
20517
|
the search starts from the last position.
|
|
@@ -20526,10 +20519,10 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20526
20519
|
of the array i.e. `startAt + array.length`.
|
|
20527
20520
|
- If it's any other positive number, will search backwards
|
|
20528
20521
|
from that index of the array.
|
|
20529
|
-
|
|
20530
|
-
|
|
20522
|
+
Returns -1 if no match is found.
|
|
20523
|
+
```javascript
|
|
20531
20524
|
let arr = ['a', 'b', 'c', 'd', 'a'];
|
|
20532
|
-
|
|
20525
|
+
arr.lastIndexOf('a'); // 4
|
|
20533
20526
|
arr.lastIndexOf('z'); // -1
|
|
20534
20527
|
arr.lastIndexOf('a', 2); // 0
|
|
20535
20528
|
arr.lastIndexOf('a', -1); // 4
|
|
@@ -20537,7 +20530,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20537
20530
|
arr.lastIndexOf('b', 3); // 1
|
|
20538
20531
|
arr.lastIndexOf('a', 100); // 4
|
|
20539
20532
|
```
|
|
20540
|
-
|
|
20533
|
+
@method lastIndexOf
|
|
20541
20534
|
@param {Object} object the item to search for
|
|
20542
20535
|
@param {Number} startAt optional starting location to search from
|
|
20543
20536
|
backwards, defaults to `(array.length - 1)`
|
|
@@ -20569,26 +20562,26 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20569
20562
|
Iterates through the array, calling the passed function on each
|
|
20570
20563
|
item. This method corresponds to the `forEach()` method defined in
|
|
20571
20564
|
JavaScript 1.6.
|
|
20572
|
-
|
|
20565
|
+
The callback method you provide should have the following signature (all
|
|
20573
20566
|
parameters are optional):
|
|
20574
|
-
|
|
20567
|
+
```javascript
|
|
20575
20568
|
function(item, index, array);
|
|
20576
20569
|
```
|
|
20577
|
-
|
|
20570
|
+
- `item` is the current item in the iteration.
|
|
20578
20571
|
- `index` is the current index in the iteration.
|
|
20579
20572
|
- `array` is the array itself.
|
|
20580
|
-
|
|
20573
|
+
Note that in addition to a callback, you can also pass an optional target
|
|
20581
20574
|
object that will be set as `this` on the context. This is a good way
|
|
20582
20575
|
to give your iterator function access to the current object.
|
|
20583
|
-
|
|
20584
|
-
|
|
20576
|
+
Example Usage:
|
|
20577
|
+
```javascript
|
|
20585
20578
|
let foods = [
|
|
20586
20579
|
{ name: 'apple', eaten: false },
|
|
20587
20580
|
{ name: 'banana', eaten: false },
|
|
20588
20581
|
{ name: 'carrot', eaten: false }
|
|
20589
20582
|
];
|
|
20590
|
-
|
|
20591
|
-
|
|
20583
|
+
foods.forEach((food) => food.eaten = true);
|
|
20584
|
+
let output = '';
|
|
20592
20585
|
foods.forEach((item, index, array) =>
|
|
20593
20586
|
output += `${index + 1}/${array.length} ${item.name}\n`;
|
|
20594
20587
|
);
|
|
@@ -20597,7 +20590,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20597
20590
|
// 2/3 banana
|
|
20598
20591
|
// 3/3 carrot
|
|
20599
20592
|
```
|
|
20600
|
-
|
|
20593
|
+
@method forEach
|
|
20601
20594
|
@param {Function} callback The callback to execute
|
|
20602
20595
|
@param {Object} [target] The target object to use
|
|
20603
20596
|
@return {Object} receiver
|
|
@@ -20621,16 +20614,16 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20621
20614
|
|
|
20622
20615
|
/**
|
|
20623
20616
|
Alias for `mapBy`.
|
|
20624
|
-
|
|
20617
|
+
Returns the value of the named
|
|
20625
20618
|
property on all items in the enumeration.
|
|
20626
|
-
|
|
20619
|
+
```javascript
|
|
20627
20620
|
let people = [{name: 'Joe'}, {name: 'Matt'}];
|
|
20628
|
-
|
|
20621
|
+
people.getEach('name');
|
|
20629
20622
|
// ['Joe', 'Matt'];
|
|
20630
|
-
|
|
20623
|
+
people.getEach('nonexistentProperty');
|
|
20631
20624
|
// [undefined, undefined];
|
|
20632
20625
|
```
|
|
20633
|
-
|
|
20626
|
+
@method getEach
|
|
20634
20627
|
@param {String} key name of the property
|
|
20635
20628
|
@return {Array} The mapped array.
|
|
20636
20629
|
@public
|
|
@@ -20642,12 +20635,12 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20642
20635
|
ergonomic than using other methods defined on this helper. If the object
|
|
20643
20636
|
implements Observable, the value will be changed to `set(),` otherwise
|
|
20644
20637
|
it will be set directly. `null` objects are skipped.
|
|
20645
|
-
|
|
20638
|
+
```javascript
|
|
20646
20639
|
let people = [{name: 'Joe'}, {name: 'Matt'}];
|
|
20647
|
-
|
|
20640
|
+
people.setEach('zipCode', '10011');
|
|
20648
20641
|
// [{name: 'Joe', zipCode: '10011'}, {name: 'Matt', zipCode: '10011'}];
|
|
20649
20642
|
```
|
|
20650
|
-
|
|
20643
|
+
@method setEach
|
|
20651
20644
|
@param {String} key The key to set
|
|
20652
20645
|
@param {Object} value The object to set
|
|
20653
20646
|
@return {Object} receiver
|
|
@@ -20660,24 +20653,24 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20660
20653
|
/**
|
|
20661
20654
|
Maps all of the items in the enumeration to another value, returning
|
|
20662
20655
|
a new array. This method corresponds to `map()` defined in JavaScript 1.6.
|
|
20663
|
-
|
|
20656
|
+
The callback method you provide should have the following signature (all
|
|
20664
20657
|
parameters are optional):
|
|
20665
|
-
|
|
20658
|
+
```javascript
|
|
20666
20659
|
function(item, index, array);
|
|
20667
20660
|
let arr = [1, 2, 3, 4, 5, 6];
|
|
20668
|
-
|
|
20661
|
+
arr.map(element => element * element);
|
|
20669
20662
|
// [1, 4, 9, 16, 25, 36];
|
|
20670
|
-
|
|
20663
|
+
arr.map((element, index) => element + index);
|
|
20671
20664
|
// [1, 3, 5, 7, 9, 11];
|
|
20672
20665
|
```
|
|
20673
|
-
|
|
20666
|
+
- `item` is the current item in the iteration.
|
|
20674
20667
|
- `index` is the current index in the iteration.
|
|
20675
20668
|
- `array` is the array itself.
|
|
20676
|
-
|
|
20677
|
-
|
|
20669
|
+
It should return the mapped value.
|
|
20670
|
+
Note that in addition to a callback, you can also pass an optional target
|
|
20678
20671
|
object that will be set as `this` on the context. This is a good way
|
|
20679
20672
|
to give your iterator function access to the current object.
|
|
20680
|
-
|
|
20673
|
+
@method map
|
|
20681
20674
|
@param {Function} callback The callback to execute
|
|
20682
20675
|
@param {Object} [target] The target object to use
|
|
20683
20676
|
@return {Array} The mapped array.
|
|
@@ -20697,14 +20690,14 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20697
20690
|
/**
|
|
20698
20691
|
Similar to map, this specialized function returns the value of the named
|
|
20699
20692
|
property on all items in the enumeration.
|
|
20700
|
-
|
|
20693
|
+
```javascript
|
|
20701
20694
|
let people = [{name: 'Joe'}, {name: 'Matt'}];
|
|
20702
|
-
|
|
20695
|
+
people.mapBy('name');
|
|
20703
20696
|
// ['Joe', 'Matt'];
|
|
20704
|
-
|
|
20697
|
+
people.mapBy('unknownProperty');
|
|
20705
20698
|
// [undefined, undefined];
|
|
20706
20699
|
```
|
|
20707
|
-
|
|
20700
|
+
@method mapBy
|
|
20708
20701
|
@param {String} key name of the property
|
|
20709
20702
|
@return {Array} The mapped array.
|
|
20710
20703
|
@public
|
|
@@ -20714,42 +20707,42 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20714
20707
|
/**
|
|
20715
20708
|
Returns a new array with all of the items in the enumeration that the provided
|
|
20716
20709
|
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).
|
|
20717
|
-
|
|
20718
|
-
|
|
20710
|
+
The callback method should have the following signature:
|
|
20711
|
+
```javascript
|
|
20719
20712
|
function(item, index, array);
|
|
20720
20713
|
```
|
|
20721
|
-
|
|
20714
|
+
- `item` is the current item in the iteration.
|
|
20722
20715
|
- `index` is the current index in the iteration.
|
|
20723
20716
|
- `array` is the array itself.
|
|
20724
|
-
|
|
20717
|
+
All parameters are optional. The function should return `true` to include the item
|
|
20725
20718
|
in the results, and `false` otherwise.
|
|
20726
|
-
|
|
20727
|
-
|
|
20719
|
+
Example:
|
|
20720
|
+
```javascript
|
|
20728
20721
|
function isAdult(person) {
|
|
20729
20722
|
return person.age > 18;
|
|
20730
20723
|
};
|
|
20731
|
-
|
|
20732
|
-
|
|
20724
|
+
let people = Ember.A([{ name: 'John', age: 14 }, { name: 'Joan', age: 45 }]);
|
|
20725
|
+
people.filter(isAdult); // returns [{ name: 'Joan', age: 45 }];
|
|
20733
20726
|
```
|
|
20734
|
-
|
|
20727
|
+
Note that in addition to a callback, you can pass an optional target object
|
|
20735
20728
|
that will be set as `this` on the context. This is a good way to give your
|
|
20736
20729
|
iterator function access to the current object. For example:
|
|
20737
|
-
|
|
20730
|
+
```javascript
|
|
20738
20731
|
function isAdultAndEngineer(person) {
|
|
20739
20732
|
return person.age > 18 && this.engineering;
|
|
20740
20733
|
}
|
|
20741
|
-
|
|
20734
|
+
class AdultsCollection {
|
|
20742
20735
|
engineering = false;
|
|
20743
|
-
|
|
20736
|
+
constructor(opts = {}) {
|
|
20744
20737
|
super(...arguments);
|
|
20745
|
-
|
|
20738
|
+
this.engineering = opts.engineering;
|
|
20746
20739
|
this.people = Ember.A([{ name: 'John', age: 14 }, { name: 'Joan', age: 45 }]);
|
|
20747
20740
|
}
|
|
20748
20741
|
}
|
|
20749
|
-
|
|
20742
|
+
let collection = new AdultsCollection({ engineering: true });
|
|
20750
20743
|
collection.people.filter(isAdultAndEngineer, { target: collection });
|
|
20751
20744
|
```
|
|
20752
|
-
|
|
20745
|
+
@method filter
|
|
20753
20746
|
@param {Function} callback The callback to execute
|
|
20754
20747
|
@param {Object} [target] The target object to use
|
|
20755
20748
|
@return {Array} A filtered array.
|
|
@@ -20773,20 +20766,20 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20773
20766
|
/**
|
|
20774
20767
|
Returns an array with all of the items in the enumeration where the passed
|
|
20775
20768
|
function returns false. This method is the inverse of filter().
|
|
20776
|
-
|
|
20769
|
+
The callback method you provide should have the following signature (all
|
|
20777
20770
|
parameters are optional):
|
|
20778
|
-
|
|
20771
|
+
```javascript
|
|
20779
20772
|
function(item, index, array);
|
|
20780
20773
|
```
|
|
20781
|
-
|
|
20774
|
+
- *item* is the current item in the iteration.
|
|
20782
20775
|
- *index* is the current index in the iteration
|
|
20783
20776
|
- *array* is the array itself.
|
|
20784
|
-
|
|
20785
|
-
|
|
20777
|
+
It should return a falsey value to include the item in the results.
|
|
20778
|
+
Note that in addition to a callback, you can also pass an optional target
|
|
20786
20779
|
object that will be set as "this" on the context. This is a good way
|
|
20787
20780
|
to give your iterator function access to the current object.
|
|
20788
|
-
|
|
20789
|
-
|
|
20781
|
+
Example Usage:
|
|
20782
|
+
```javascript
|
|
20790
20783
|
const food = [
|
|
20791
20784
|
{ food: 'apple', isFruit: true },
|
|
20792
20785
|
{ food: 'bread', isFruit: false },
|
|
@@ -20796,7 +20789,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20796
20789
|
return thing.isFruit;
|
|
20797
20790
|
}); // [{food: 'bread', isFruit: false}]
|
|
20798
20791
|
```
|
|
20799
|
-
|
|
20792
|
+
@method reject
|
|
20800
20793
|
@param {Function} callback The callback to execute
|
|
20801
20794
|
@param {Object} [target] The target object to use
|
|
20802
20795
|
@return {Array} A rejected array.
|
|
@@ -20809,6 +20802,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20809
20802
|
|
|
20810
20803
|
(true && !(typeof callback === 'function') && (0, _debug.assert)('`reject` expects a function as first argument.', typeof callback === 'function'));
|
|
20811
20804
|
return this.filter(function () {
|
|
20805
|
+
// @ts-expect-error TS doesn't like us using arguments like this
|
|
20812
20806
|
return !callback.apply(target, arguments);
|
|
20813
20807
|
});
|
|
20814
20808
|
},
|
|
@@ -20817,19 +20811,20 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20817
20811
|
Filters the array by the property and an optional value. If a value is given, it returns
|
|
20818
20812
|
the items that have said value for the property. If not, it returns all the items that
|
|
20819
20813
|
have a truthy value for the property.
|
|
20820
|
-
|
|
20821
|
-
|
|
20814
|
+
Example Usage:
|
|
20815
|
+
```javascript
|
|
20822
20816
|
let things = Ember.A([{ food: 'apple', isFruit: true }, { food: 'beans', isFruit: false }]);
|
|
20823
|
-
|
|
20817
|
+
things.filterBy('food', 'beans'); // [{ food: 'beans', isFruit: false }]
|
|
20824
20818
|
things.filterBy('isFruit'); // [{ food: 'apple', isFruit: true }]
|
|
20825
20819
|
```
|
|
20826
|
-
|
|
20820
|
+
@method filterBy
|
|
20827
20821
|
@param {String} key the property to test
|
|
20828
20822
|
@param {*} [value] optional value to test against.
|
|
20829
20823
|
@return {Array} filtered array
|
|
20830
20824
|
@public
|
|
20831
20825
|
*/
|
|
20832
20826
|
filterBy() {
|
|
20827
|
+
// @ts-expect-error TS doesn't like the ...arguments spread here.
|
|
20833
20828
|
return this.filter(iter(...arguments));
|
|
20834
20829
|
},
|
|
20835
20830
|
|
|
@@ -20837,8 +20832,8 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20837
20832
|
Returns an array with the items that do not have truthy values for the provided key.
|
|
20838
20833
|
You can pass an optional second argument with a target value to reject for the key.
|
|
20839
20834
|
Otherwise this will reject objects where the provided property evaluates to false.
|
|
20840
|
-
|
|
20841
|
-
|
|
20835
|
+
Example Usage:
|
|
20836
|
+
```javascript
|
|
20842
20837
|
let food = [
|
|
20843
20838
|
{ name: "apple", isFruit: true },
|
|
20844
20839
|
{ name: "carrot", isFruit: false },
|
|
@@ -20847,44 +20842,45 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20847
20842
|
food.rejectBy('isFruit'); // [{ name: "carrot", isFruit: false }, { name: "bread", isFruit: false }]
|
|
20848
20843
|
food.rejectBy('name', 'carrot'); // [{ name: "apple", isFruit: true }}, { name: "bread", isFruit: false }]
|
|
20849
20844
|
```
|
|
20850
|
-
|
|
20845
|
+
@method rejectBy
|
|
20851
20846
|
@param {String} key the property to test
|
|
20852
20847
|
@param {*} [value] optional value to test against.
|
|
20853
20848
|
@return {Array} rejected array
|
|
20854
20849
|
@public
|
|
20855
20850
|
*/
|
|
20856
20851
|
rejectBy() {
|
|
20852
|
+
// @ts-expect-error TS doesn't like the ...arguments spread here.
|
|
20857
20853
|
return this.reject(iter(...arguments));
|
|
20858
20854
|
},
|
|
20859
20855
|
|
|
20860
20856
|
/**
|
|
20861
20857
|
Returns the first item in the array for which the callback returns true.
|
|
20862
20858
|
This method is similar to the `find()` method defined in ECMAScript 2015.
|
|
20863
|
-
|
|
20859
|
+
The callback method you provide should have the following signature (all
|
|
20864
20860
|
parameters are optional):
|
|
20865
|
-
|
|
20861
|
+
```javascript
|
|
20866
20862
|
function(item, index, array);
|
|
20867
20863
|
```
|
|
20868
|
-
|
|
20864
|
+
- `item` is the current item in the iteration.
|
|
20869
20865
|
- `index` is the current index in the iteration.
|
|
20870
20866
|
- `array` is the array itself.
|
|
20871
|
-
|
|
20867
|
+
It should return the `true` to include the item in the results, `false`
|
|
20872
20868
|
otherwise.
|
|
20873
|
-
|
|
20869
|
+
Note that in addition to a callback, you can also pass an optional target
|
|
20874
20870
|
object that will be set as `this` on the context. This is a good way
|
|
20875
20871
|
to give your iterator function access to the current object.
|
|
20876
|
-
|
|
20877
|
-
|
|
20872
|
+
Example Usage:
|
|
20873
|
+
```javascript
|
|
20878
20874
|
let users = [
|
|
20879
20875
|
{ id: 1, name: 'Yehuda' },
|
|
20880
20876
|
{ id: 2, name: 'Tom' },
|
|
20881
20877
|
{ id: 3, name: 'Melanie' },
|
|
20882
20878
|
{ id: 4, name: 'Leah' }
|
|
20883
20879
|
];
|
|
20884
|
-
|
|
20880
|
+
users.find((user) => user.name == 'Tom'); // [{ id: 2, name: 'Tom' }]
|
|
20885
20881
|
users.find(({ id }) => id == 3); // [{ id: 3, name: 'Melanie' }]
|
|
20886
20882
|
```
|
|
20887
|
-
|
|
20883
|
+
@method find
|
|
20888
20884
|
@param {Function} callback The callback to execute
|
|
20889
20885
|
@param {Object} [target] The target object to use
|
|
20890
20886
|
@return {Object} Found item or `undefined`.
|
|
@@ -20903,52 +20899,54 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20903
20899
|
Returns the first item with a property matching the passed value. You
|
|
20904
20900
|
can pass an optional second argument with the target value. Otherwise
|
|
20905
20901
|
this will match any property that evaluates to `true`.
|
|
20906
|
-
|
|
20907
|
-
|
|
20908
|
-
|
|
20902
|
+
This method works much like the more generic `find()` method.
|
|
20903
|
+
Usage Example:
|
|
20904
|
+
```javascript
|
|
20909
20905
|
let users = [
|
|
20910
20906
|
{ id: 1, name: 'Yehuda', isTom: false },
|
|
20911
20907
|
{ id: 2, name: 'Tom', isTom: true },
|
|
20912
20908
|
{ id: 3, name: 'Melanie', isTom: false },
|
|
20913
20909
|
{ id: 4, name: 'Leah', isTom: false }
|
|
20914
20910
|
];
|
|
20915
|
-
|
|
20911
|
+
users.findBy('id', 4); // { id: 4, name: 'Leah', isTom: false }
|
|
20916
20912
|
users.findBy('name', 'Melanie'); // { id: 3, name: 'Melanie', isTom: false }
|
|
20917
20913
|
users.findBy('isTom'); // { id: 2, name: 'Tom', isTom: true }
|
|
20918
20914
|
```
|
|
20919
|
-
|
|
20915
|
+
@method findBy
|
|
20920
20916
|
@param {String} key the property to test
|
|
20921
20917
|
@param {String} [value] optional value to test against.
|
|
20922
20918
|
@return {Object} found item or `undefined`
|
|
20923
20919
|
@public
|
|
20924
20920
|
*/
|
|
20925
20921
|
findBy() {
|
|
20926
|
-
|
|
20922
|
+
// @ts-expect-error TS doesn't like the ...arguments spread here.
|
|
20923
|
+
var callback = iter(...arguments);
|
|
20924
|
+
return find(this, callback);
|
|
20927
20925
|
},
|
|
20928
20926
|
|
|
20929
20927
|
/**
|
|
20930
20928
|
Returns `true` if the passed function returns true for every item in the
|
|
20931
20929
|
enumeration. This corresponds with the `Array.prototype.every()` method defined in ES5.
|
|
20932
|
-
|
|
20933
|
-
|
|
20930
|
+
The callback method should have the following signature:
|
|
20931
|
+
```javascript
|
|
20934
20932
|
function(item, index, array);
|
|
20935
20933
|
```
|
|
20936
|
-
|
|
20934
|
+
- `item` is the current item in the iteration.
|
|
20937
20935
|
- `index` is the current index in the iteration.
|
|
20938
20936
|
- `array` is the array itself.
|
|
20939
|
-
|
|
20940
|
-
|
|
20937
|
+
All params are optional. The method should return `true` or `false`.
|
|
20938
|
+
Note that in addition to a callback, you can also pass an optional target
|
|
20941
20939
|
object that will be set as `this` on the context. This is a good way
|
|
20942
20940
|
to give your iterator function access to the current object.
|
|
20943
|
-
|
|
20944
|
-
|
|
20941
|
+
Usage example:
|
|
20942
|
+
```javascript
|
|
20945
20943
|
function isAdult(person) {
|
|
20946
20944
|
return person.age > 18;
|
|
20947
20945
|
};
|
|
20948
|
-
|
|
20946
|
+
const people = Ember.A([{ name: 'John', age: 24 }, { name: 'Joan', age: 45 }]);
|
|
20949
20947
|
const areAllAdults = people.every(isAdult);
|
|
20950
20948
|
```
|
|
20951
|
-
|
|
20949
|
+
@method every
|
|
20952
20950
|
@param {Function} callback The callback to execute
|
|
20953
20951
|
@param {Object} [target] The target object to use
|
|
20954
20952
|
@return {Boolean}
|
|
@@ -20967,7 +20965,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20967
20965
|
Returns `true` if the passed property resolves to the value of the second
|
|
20968
20966
|
argument for all items in the array. This method is often simpler/faster
|
|
20969
20967
|
than using a callback.
|
|
20970
|
-
|
|
20968
|
+
Note that like the native `Array.every`, `isEvery` will return true when called
|
|
20971
20969
|
on any empty array.
|
|
20972
20970
|
```javascript
|
|
20973
20971
|
class Language {
|
|
@@ -20976,20 +20974,20 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20976
20974
|
this.programmingLanguage = isProgrammingLanguage;
|
|
20977
20975
|
}
|
|
20978
20976
|
}
|
|
20979
|
-
|
|
20977
|
+
const compiledLanguages = [
|
|
20980
20978
|
new Language('Java', true),
|
|
20981
20979
|
new Language('Go', true),
|
|
20982
20980
|
new Language('Rust', true)
|
|
20983
20981
|
]
|
|
20984
|
-
|
|
20982
|
+
const languagesKnownByMe = [
|
|
20985
20983
|
new Language('Javascript', true),
|
|
20986
20984
|
new Language('English', false),
|
|
20987
20985
|
new Language('Ruby', true)
|
|
20988
20986
|
]
|
|
20989
|
-
|
|
20987
|
+
compiledLanguages.isEvery('programmingLanguage'); // true
|
|
20990
20988
|
languagesKnownByMe.isEvery('programmingLanguage'); // false
|
|
20991
20989
|
```
|
|
20992
|
-
|
|
20990
|
+
@method isEvery
|
|
20993
20991
|
@param {String} key the property to test
|
|
20994
20992
|
@param {String} [value] optional value to test against. Defaults to `true`
|
|
20995
20993
|
@return {Boolean}
|
|
@@ -20997,7 +20995,9 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
20997
20995
|
@public
|
|
20998
20996
|
*/
|
|
20999
20997
|
isEvery() {
|
|
21000
|
-
|
|
20998
|
+
// @ts-expect-error TS doesn't like the ...arguments spread here.
|
|
20999
|
+
var callback = iter(...arguments);
|
|
21000
|
+
return every(this, callback);
|
|
21001
21001
|
},
|
|
21002
21002
|
|
|
21003
21003
|
/**
|
|
@@ -21005,27 +21005,27 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21005
21005
|
present in the array until it finds the one where callback returns a truthy
|
|
21006
21006
|
value (i.e. `true`). If such an element is found, any() immediately returns
|
|
21007
21007
|
true. Otherwise, any() returns false.
|
|
21008
|
-
|
|
21008
|
+
```javascript
|
|
21009
21009
|
function(item, index, array);
|
|
21010
21010
|
```
|
|
21011
|
-
|
|
21011
|
+
- `item` is the current item in the iteration.
|
|
21012
21012
|
- `index` is the current index in the iteration.
|
|
21013
21013
|
- `array` is the array object itself.
|
|
21014
|
-
|
|
21014
|
+
Note that in addition to a callback, you can also pass an optional target
|
|
21015
21015
|
object that will be set as `this` on the context. It can be a good way
|
|
21016
21016
|
to give your iterator function access to an object in cases where an ES6
|
|
21017
21017
|
arrow function would not be appropriate.
|
|
21018
|
-
|
|
21019
|
-
|
|
21018
|
+
Usage Example:
|
|
21019
|
+
```javascript
|
|
21020
21020
|
let includesManager = people.any(this.findPersonInManagersList, this);
|
|
21021
|
-
|
|
21021
|
+
let includesStockHolder = people.any(person => {
|
|
21022
21022
|
return this.findPersonInStockHoldersList(person)
|
|
21023
21023
|
});
|
|
21024
|
-
|
|
21024
|
+
if (includesManager || includesStockHolder) {
|
|
21025
21025
|
Paychecks.addBiggerBonus();
|
|
21026
21026
|
}
|
|
21027
21027
|
```
|
|
21028
|
-
|
|
21028
|
+
@method any
|
|
21029
21029
|
@param {Function} callback The callback to execute
|
|
21030
21030
|
@param {Object} [target] The target object to use
|
|
21031
21031
|
@return {Boolean} `true` if the passed function returns `true` for any item
|
|
@@ -21044,16 +21044,16 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21044
21044
|
Returns `true` if the passed property resolves to the value of the second
|
|
21045
21045
|
argument for any item in the array. This method is often simpler/faster
|
|
21046
21046
|
than using a callback.
|
|
21047
|
-
|
|
21048
|
-
|
|
21047
|
+
Example usage:
|
|
21048
|
+
```javascript
|
|
21049
21049
|
const food = [
|
|
21050
21050
|
{ food: 'apple', isFruit: true },
|
|
21051
21051
|
{ food: 'bread', isFruit: false },
|
|
21052
21052
|
{ food: 'banana', isFruit: true }
|
|
21053
21053
|
];
|
|
21054
|
-
|
|
21054
|
+
food.isAny('isFruit'); // true
|
|
21055
21055
|
```
|
|
21056
|
-
|
|
21056
|
+
@method isAny
|
|
21057
21057
|
@param {String} key the property to test
|
|
21058
21058
|
@param {String} [value] optional value to test against. Defaults to `true`
|
|
21059
21059
|
@return {Boolean}
|
|
@@ -21061,44 +21061,47 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21061
21061
|
@public
|
|
21062
21062
|
*/
|
|
21063
21063
|
isAny() {
|
|
21064
|
-
|
|
21064
|
+
// @ts-expect-error TS doesn't like us using arguments like this
|
|
21065
|
+
var callback = iter(...arguments);
|
|
21066
|
+
return any(this, callback);
|
|
21065
21067
|
},
|
|
21066
21068
|
|
|
21067
21069
|
/**
|
|
21068
21070
|
This will combine the values of the array into a single value. It
|
|
21069
21071
|
is a useful way to collect a summary value from an array. This
|
|
21070
21072
|
corresponds to the `reduce()` method defined in JavaScript 1.8.
|
|
21071
|
-
|
|
21073
|
+
The callback method you provide should have the following signature (all
|
|
21072
21074
|
parameters are optional):
|
|
21073
|
-
|
|
21075
|
+
```javascript
|
|
21074
21076
|
function(previousValue, item, index, array);
|
|
21075
21077
|
```
|
|
21076
|
-
|
|
21078
|
+
- `previousValue` is the value returned by the last call to the iterator.
|
|
21077
21079
|
- `item` is the current item in the iteration.
|
|
21078
21080
|
- `index` is the current index in the iteration.
|
|
21079
21081
|
- `array` is the array itself.
|
|
21080
|
-
|
|
21081
|
-
|
|
21082
|
+
Return the new cumulative value.
|
|
21083
|
+
In addition to the callback you can also pass an `initialValue`. An error
|
|
21082
21084
|
will be raised if you do not pass an initial value and the enumerator is
|
|
21083
21085
|
empty.
|
|
21084
|
-
|
|
21086
|
+
Note that unlike the other methods, this method does not allow you to
|
|
21085
21087
|
pass a target object to set as this for the callback. It's part of the
|
|
21086
21088
|
spec. Sorry.
|
|
21087
|
-
|
|
21088
|
-
|
|
21089
|
+
Example Usage:
|
|
21090
|
+
```javascript
|
|
21089
21091
|
let numbers = [1, 2, 3, 4, 5];
|
|
21090
|
-
|
|
21092
|
+
numbers.reduce(function(summation, current) {
|
|
21091
21093
|
return summation + current;
|
|
21092
21094
|
}); // 15 (1 + 2 + 3 + 4 + 5)
|
|
21093
|
-
|
|
21095
|
+
numbers.reduce(function(summation, current) {
|
|
21094
21096
|
return summation + current;
|
|
21095
21097
|
}, -15); // 0 (-15 + 1 + 2 + 3 + 4 + 5)
|
|
21096
|
-
|
|
21097
|
-
|
|
21098
|
+
|
|
21099
|
+
let binaryValues = [true, false, false];
|
|
21100
|
+
binaryValues.reduce(function(truthValue, current) {
|
|
21098
21101
|
return truthValue && current;
|
|
21099
21102
|
}); // false (true && false && false)
|
|
21100
21103
|
```
|
|
21101
|
-
|
|
21104
|
+
@method reduce
|
|
21102
21105
|
@param {Function} callback The callback to execute
|
|
21103
21106
|
@param {Object} initialValue Initial value for the reduce
|
|
21104
21107
|
@return {Object} The reduced value.
|
|
@@ -21118,40 +21121,45 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21118
21121
|
Invokes the named method on every object in the receiver that
|
|
21119
21122
|
implements it. This method corresponds to the implementation in
|
|
21120
21123
|
Prototype 1.6.
|
|
21121
|
-
|
|
21124
|
+
```javascript
|
|
21122
21125
|
class Person {
|
|
21123
21126
|
name = null;
|
|
21124
|
-
|
|
21127
|
+
constructor(name) {
|
|
21125
21128
|
this.name = name;
|
|
21126
21129
|
}
|
|
21127
|
-
|
|
21130
|
+
greet(prefix='Hello') {
|
|
21128
21131
|
return `${prefix} ${this.name}`;
|
|
21129
21132
|
}
|
|
21130
21133
|
}
|
|
21131
|
-
|
|
21132
|
-
|
|
21134
|
+
let people = [new Person('Joe'), new Person('Matt')];
|
|
21135
|
+
people.invoke('greet'); // ['Hello Joe', 'Hello Matt']
|
|
21133
21136
|
people.invoke('greet', 'Bonjour'); // ['Bonjour Joe', 'Bonjour Matt']
|
|
21134
21137
|
```
|
|
21135
|
-
|
|
21138
|
+
@method invoke
|
|
21136
21139
|
@param {String} methodName the name of the method
|
|
21137
21140
|
@param {Object...} args optional arguments to pass as well.
|
|
21138
21141
|
@return {Array} return values from calling invoke.
|
|
21139
21142
|
@public
|
|
21140
21143
|
*/
|
|
21141
21144
|
invoke(methodName) {
|
|
21142
|
-
for (var
|
|
21143
|
-
args[
|
|
21145
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key3 = 1; _key3 < _len2; _key3++) {
|
|
21146
|
+
args[_key3 - 1] = arguments[_key3];
|
|
21144
21147
|
}
|
|
21145
21148
|
|
|
21146
|
-
var ret = A();
|
|
21147
|
-
|
|
21149
|
+
var ret = A(); // SAFETY: This is not entirely safe and the code will not work with Ember proxies
|
|
21150
|
+
|
|
21151
|
+
this.forEach(item => {
|
|
21152
|
+
var _a, _b;
|
|
21153
|
+
|
|
21154
|
+
return ret.push((_b = (_a = item)[methodName]) === null || _b === void 0 ? void 0 : _b.call(_a, ...args));
|
|
21155
|
+
});
|
|
21148
21156
|
return ret;
|
|
21149
21157
|
},
|
|
21150
21158
|
|
|
21151
21159
|
/**
|
|
21152
21160
|
Simply converts the object into a genuine array. The order is not
|
|
21153
21161
|
guaranteed. Corresponds to the method implemented by Prototype.
|
|
21154
|
-
|
|
21162
|
+
@method toArray
|
|
21155
21163
|
@return {Array} the object as an array.
|
|
21156
21164
|
@public
|
|
21157
21165
|
*/
|
|
@@ -21161,11 +21169,11 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21161
21169
|
|
|
21162
21170
|
/**
|
|
21163
21171
|
Returns a copy of the array with all `null` and `undefined` elements removed.
|
|
21164
|
-
|
|
21172
|
+
```javascript
|
|
21165
21173
|
let arr = ['a', null, 'c', undefined];
|
|
21166
21174
|
arr.compact(); // ['a', 'c']
|
|
21167
21175
|
```
|
|
21168
|
-
|
|
21176
|
+
@method compact
|
|
21169
21177
|
@return {Array} the array without null and undefined elements.
|
|
21170
21178
|
@public
|
|
21171
21179
|
*/
|
|
@@ -21176,13 +21184,13 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21176
21184
|
/**
|
|
21177
21185
|
Used to determine if the array contains the passed object.
|
|
21178
21186
|
Returns `true` if found, `false` otherwise.
|
|
21179
|
-
|
|
21187
|
+
The optional `startAt` argument can be used to pass a starting
|
|
21180
21188
|
index to search from, effectively slicing the searchable portion
|
|
21181
21189
|
of the array. If it's negative it will add the array length to
|
|
21182
21190
|
the startAt value passed in as the index to search from. If less
|
|
21183
21191
|
than or equal to `-1 * array.length` the entire array is searched.
|
|
21184
|
-
|
|
21185
|
-
|
|
21192
|
+
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).
|
|
21193
|
+
```javascript
|
|
21186
21194
|
[1, 2, 3].includes(2); // true
|
|
21187
21195
|
[1, 2, 3].includes(4); // false
|
|
21188
21196
|
[1, 2, 3].includes(3, 2); // true
|
|
@@ -21192,7 +21200,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21192
21200
|
[1, 2, 3].includes(1, -4); // true
|
|
21193
21201
|
[1, 2, NaN].includes(NaN); // true
|
|
21194
21202
|
```
|
|
21195
|
-
|
|
21203
|
+
@method includes
|
|
21196
21204
|
@param {Object} object The object to search for.
|
|
21197
21205
|
@param {Number} startAt optional starting location to search, default 0
|
|
21198
21206
|
@return {Boolean} `true` if object is found in the array.
|
|
@@ -21204,19 +21212,19 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21204
21212
|
|
|
21205
21213
|
/**
|
|
21206
21214
|
Sorts the array by the keys specified in the argument.
|
|
21207
|
-
|
|
21208
|
-
|
|
21215
|
+
You may provide multiple arguments to sort by multiple properties.
|
|
21216
|
+
```javascript
|
|
21209
21217
|
let colors = [
|
|
21210
21218
|
{ name: 'red', weight: 500 },
|
|
21211
21219
|
{ name: 'green', weight: 600 },
|
|
21212
21220
|
{ name: 'blue', weight: 500 }
|
|
21213
21221
|
];
|
|
21214
|
-
|
|
21222
|
+
colors.sortBy('name');
|
|
21215
21223
|
// [{name: 'blue', weight: 500}, {name: 'green', weight: 600}, {name: 'red', weight: 500}]
|
|
21216
|
-
|
|
21224
|
+
colors.sortBy('weight', 'name');
|
|
21217
21225
|
// [{name: 'blue', weight: 500}, {name: 'red', weight: 500}, {name: 'green', weight: 600}]
|
|
21218
21226
|
```
|
|
21219
|
-
|
|
21227
|
+
@method sortBy
|
|
21220
21228
|
@param {String} property name(s) to sort on
|
|
21221
21229
|
@return {Array} The sorted array.
|
|
21222
21230
|
@since 1.2.0
|
|
@@ -21244,12 +21252,12 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21244
21252
|
/**
|
|
21245
21253
|
Returns a new array that contains only unique values. The default
|
|
21246
21254
|
implementation returns an array regardless of the receiver type.
|
|
21247
|
-
|
|
21255
|
+
```javascript
|
|
21248
21256
|
let arr = ['a', 'a', 'b', 'b'];
|
|
21249
21257
|
arr.uniq(); // ['a', 'b']
|
|
21250
21258
|
```
|
|
21251
|
-
|
|
21252
|
-
|
|
21259
|
+
This only works on primitive data types, e.g. Strings, Numbers, etc.
|
|
21260
|
+
@method uniq
|
|
21253
21261
|
@return {EmberArray}
|
|
21254
21262
|
@public
|
|
21255
21263
|
*/
|
|
@@ -21260,13 +21268,13 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21260
21268
|
/**
|
|
21261
21269
|
Returns a new array that contains only items containing a unique property value.
|
|
21262
21270
|
The default implementation returns an array regardless of the receiver type.
|
|
21263
|
-
|
|
21271
|
+
```javascript
|
|
21264
21272
|
let arr = [{ value: 'a' }, { value: 'a' }, { value: 'b' }, { value: 'b' }];
|
|
21265
21273
|
arr.uniqBy('value'); // [{ value: 'a' }, { value: 'b' }]
|
|
21266
|
-
|
|
21274
|
+
let arr = [2.2, 2.1, 3.2, 3.3];
|
|
21267
21275
|
arr.uniqBy(Math.floor); // [2.2, 3.2];
|
|
21268
21276
|
```
|
|
21269
|
-
|
|
21277
|
+
@method uniqBy
|
|
21270
21278
|
@param {String,Function} key
|
|
21271
21279
|
@return {EmberArray}
|
|
21272
21280
|
@public
|
|
@@ -21279,11 +21287,11 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21279
21287
|
Returns a new array that excludes the passed value. The default
|
|
21280
21288
|
implementation returns an array regardless of the receiver type.
|
|
21281
21289
|
If the receiver does not contain the value it returns the original array.
|
|
21282
|
-
|
|
21290
|
+
```javascript
|
|
21283
21291
|
let arr = ['a', 'b', 'a', 'c'];
|
|
21284
21292
|
arr.without('a'); // ['b', 'c']
|
|
21285
21293
|
```
|
|
21286
|
-
|
|
21294
|
+
@method without
|
|
21287
21295
|
@param {Object} value
|
|
21288
21296
|
@return {EmberArray}
|
|
21289
21297
|
@public
|
|
@@ -21299,36 +21307,15 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21299
21307
|
}
|
|
21300
21308
|
|
|
21301
21309
|
});
|
|
21302
|
-
/**
|
|
21303
|
-
This mixin defines the API for modifying array-like objects. These methods
|
|
21304
|
-
can be applied only to a collection that keeps its items in an ordered set.
|
|
21305
|
-
It builds upon the Array mixin and adds methods to modify the array.
|
|
21306
|
-
One concrete implementations of this class include ArrayProxy.
|
|
21307
|
-
|
|
21308
|
-
It is important to use the methods in this class to modify arrays so that
|
|
21309
|
-
changes are observable. This allows the binding system in Ember to function
|
|
21310
|
-
correctly.
|
|
21311
|
-
|
|
21312
|
-
|
|
21313
|
-
Note that an Array can change even if it does not implement this mixin.
|
|
21314
|
-
For example, one might implement a SparseArray that cannot be directly
|
|
21315
|
-
modified, but if its underlying enumerable changes, it will change also.
|
|
21316
|
-
|
|
21317
|
-
@class MutableArray
|
|
21318
|
-
@uses EmberArray
|
|
21319
|
-
@uses MutableEnumerable
|
|
21320
|
-
@public
|
|
21321
|
-
*/
|
|
21322
|
-
|
|
21323
21310
|
|
|
21324
|
-
var MutableArray = _metal.Mixin.create(
|
|
21311
|
+
var MutableArray = _metal.Mixin.create(EmberArray, _mutable_enumerable.default, {
|
|
21325
21312
|
/**
|
|
21326
21313
|
__Required.__ You must implement this method to apply this mixin.
|
|
21327
|
-
|
|
21314
|
+
This is one of the primitives you must implement to support `Array`.
|
|
21328
21315
|
You should replace amt objects started at idx with the objects in the
|
|
21329
21316
|
passed array.
|
|
21330
|
-
|
|
21331
|
-
|
|
21317
|
+
Note that this method is expected to validate the type(s) of objects that it expects.
|
|
21318
|
+
@method replace
|
|
21332
21319
|
@param {Number} idx Starting index in the array to replace. If
|
|
21333
21320
|
idx >= length, then append to the end of the array.
|
|
21334
21321
|
@param {Number} amt Number of elements that should be removed from
|
|
@@ -21341,13 +21328,13 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21341
21328
|
/**
|
|
21342
21329
|
Remove all elements from the array. This is useful if you
|
|
21343
21330
|
want to reuse an existing array without having to recreate it.
|
|
21344
|
-
|
|
21331
|
+
```javascript
|
|
21345
21332
|
let colors = ['red', 'green', 'blue'];
|
|
21346
|
-
|
|
21333
|
+
colors.length; // 3
|
|
21347
21334
|
colors.clear(); // []
|
|
21348
21335
|
colors.length; // 0
|
|
21349
21336
|
```
|
|
21350
|
-
|
|
21337
|
+
@method clear
|
|
21351
21338
|
@return {Array} An empty Array.
|
|
21352
21339
|
@public
|
|
21353
21340
|
*/
|
|
@@ -21365,12 +21352,12 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21365
21352
|
/**
|
|
21366
21353
|
This will use the primitive `replace()` method to insert an object at the
|
|
21367
21354
|
specified index.
|
|
21368
|
-
|
|
21355
|
+
```javascript
|
|
21369
21356
|
let colors = ['red', 'green', 'blue'];
|
|
21370
|
-
|
|
21357
|
+
colors.insertAt(2, 'yellow'); // ['red', 'green', 'yellow', 'blue']
|
|
21371
21358
|
colors.insertAt(5, 'orange'); // Error: Index out of range
|
|
21372
21359
|
```
|
|
21373
|
-
|
|
21360
|
+
@method insertAt
|
|
21374
21361
|
@param {Number} idx index of insert the object at.
|
|
21375
21362
|
@param {Object} object object to insert
|
|
21376
21363
|
@return {EmberArray} receiver
|
|
@@ -21384,15 +21371,15 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21384
21371
|
/**
|
|
21385
21372
|
Remove an object at the specified index using the `replace()` primitive
|
|
21386
21373
|
method. You can pass either a single index, or a start and a length.
|
|
21387
|
-
|
|
21374
|
+
If you pass a start and length that is beyond the
|
|
21388
21375
|
length this method will throw an assertion.
|
|
21389
|
-
|
|
21376
|
+
```javascript
|
|
21390
21377
|
let colors = ['red', 'green', 'blue', 'yellow', 'orange'];
|
|
21391
|
-
|
|
21378
|
+
colors.removeAt(0); // ['green', 'blue', 'yellow', 'orange']
|
|
21392
21379
|
colors.removeAt(2, 2); // ['green', 'blue']
|
|
21393
21380
|
colors.removeAt(4, 2); // Error: Index out of range
|
|
21394
21381
|
```
|
|
21395
|
-
|
|
21382
|
+
@method removeAt
|
|
21396
21383
|
@param {Number} start index, start of range
|
|
21397
21384
|
@param {Number} len length of passing range
|
|
21398
21385
|
@return {EmberArray} receiver
|
|
@@ -21405,12 +21392,12 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21405
21392
|
/**
|
|
21406
21393
|
Push the object onto the end of the array. Works just like `push()` but it
|
|
21407
21394
|
is KVO-compliant.
|
|
21408
|
-
|
|
21395
|
+
```javascript
|
|
21409
21396
|
let colors = ['red', 'green'];
|
|
21410
|
-
|
|
21397
|
+
colors.pushObject('black'); // ['red', 'green', 'black']
|
|
21411
21398
|
colors.pushObject(['yellow']); // ['red', 'green', ['yellow']]
|
|
21412
21399
|
```
|
|
21413
|
-
|
|
21400
|
+
@method pushObject
|
|
21414
21401
|
@param {*} obj object to push
|
|
21415
21402
|
@return object same object passed as a param
|
|
21416
21403
|
@public
|
|
@@ -21422,13 +21409,13 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21422
21409
|
/**
|
|
21423
21410
|
Add the objects in the passed array to the end of the array. Defers
|
|
21424
21411
|
notifying observers of the change until all objects are added.
|
|
21425
|
-
|
|
21412
|
+
```javascript
|
|
21426
21413
|
let colors = ['red'];
|
|
21427
|
-
|
|
21414
|
+
colors.pushObjects(['yellow', 'orange']); // ['red', 'yellow', 'orange']
|
|
21428
21415
|
```
|
|
21429
|
-
|
|
21430
|
-
@param {
|
|
21431
|
-
@return {
|
|
21416
|
+
@method pushObjects
|
|
21417
|
+
@param {Array} objects the objects to add
|
|
21418
|
+
@return {MutableArray} receiver
|
|
21432
21419
|
@public
|
|
21433
21420
|
*/
|
|
21434
21421
|
pushObjects(objects) {
|
|
@@ -21439,12 +21426,12 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21439
21426
|
/**
|
|
21440
21427
|
Pop object from array or nil if none are left. Works just like `pop()` but
|
|
21441
21428
|
it is KVO-compliant.
|
|
21442
|
-
|
|
21429
|
+
```javascript
|
|
21443
21430
|
let colors = ['red', 'green', 'blue'];
|
|
21444
|
-
|
|
21431
|
+
colors.popObject(); // 'blue'
|
|
21445
21432
|
console.log(colors); // ['red', 'green']
|
|
21446
21433
|
```
|
|
21447
|
-
|
|
21434
|
+
@method popObject
|
|
21448
21435
|
@return object
|
|
21449
21436
|
@public
|
|
21450
21437
|
*/
|
|
@@ -21463,12 +21450,12 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21463
21450
|
/**
|
|
21464
21451
|
Shift an object from start of array or nil if none are left. Works just
|
|
21465
21452
|
like `shift()` but it is KVO-compliant.
|
|
21466
|
-
|
|
21453
|
+
```javascript
|
|
21467
21454
|
let colors = ['red', 'green', 'blue'];
|
|
21468
|
-
|
|
21455
|
+
colors.shiftObject(); // 'red'
|
|
21469
21456
|
console.log(colors); // ['green', 'blue']
|
|
21470
21457
|
```
|
|
21471
|
-
|
|
21458
|
+
@method shiftObject
|
|
21472
21459
|
@return object
|
|
21473
21460
|
@public
|
|
21474
21461
|
*/
|
|
@@ -21485,12 +21472,12 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21485
21472
|
/**
|
|
21486
21473
|
Unshift an object to start of array. Works just like `unshift()` but it is
|
|
21487
21474
|
KVO-compliant.
|
|
21488
|
-
|
|
21475
|
+
```javascript
|
|
21489
21476
|
let colors = ['red'];
|
|
21490
|
-
|
|
21477
|
+
colors.unshiftObject('yellow'); // ['yellow', 'red']
|
|
21491
21478
|
colors.unshiftObject(['black']); // [['black'], 'yellow', 'red']
|
|
21492
21479
|
```
|
|
21493
|
-
|
|
21480
|
+
@method unshiftObject
|
|
21494
21481
|
@param {*} obj object to unshift
|
|
21495
21482
|
@return object same object passed as a param
|
|
21496
21483
|
@public
|
|
@@ -21502,12 +21489,12 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21502
21489
|
/**
|
|
21503
21490
|
Adds the named objects to the beginning of the array. Defers notifying
|
|
21504
21491
|
observers until all objects have been added.
|
|
21505
|
-
|
|
21492
|
+
```javascript
|
|
21506
21493
|
let colors = ['red'];
|
|
21507
|
-
|
|
21494
|
+
colors.unshiftObjects(['black', 'white']); // ['black', 'white', 'red']
|
|
21508
21495
|
colors.unshiftObjects('yellow'); // Type Error: 'undefined' is not a function
|
|
21509
21496
|
```
|
|
21510
|
-
|
|
21497
|
+
@method unshiftObjects
|
|
21511
21498
|
@param {Enumerable} objects the objects to add
|
|
21512
21499
|
@return {EmberArray} receiver
|
|
21513
21500
|
@public
|
|
@@ -21520,7 +21507,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21520
21507
|
/**
|
|
21521
21508
|
Reverse objects in the array. Works just like `reverse()` but it is
|
|
21522
21509
|
KVO-compliant.
|
|
21523
|
-
|
|
21510
|
+
@method reverseObjects
|
|
21524
21511
|
@return {EmberArray} receiver
|
|
21525
21512
|
@public
|
|
21526
21513
|
*/
|
|
@@ -21539,12 +21526,12 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21539
21526
|
/**
|
|
21540
21527
|
Replace all the receiver's content with content of the argument.
|
|
21541
21528
|
If argument is an empty array receiver will be cleared.
|
|
21542
|
-
|
|
21529
|
+
```javascript
|
|
21543
21530
|
let colors = ['red', 'green', 'blue'];
|
|
21544
|
-
|
|
21531
|
+
colors.setObjects(['black', 'white']); // ['black', 'white']
|
|
21545
21532
|
colors.setObjects([]); // []
|
|
21546
21533
|
```
|
|
21547
|
-
|
|
21534
|
+
@method setObjects
|
|
21548
21535
|
@param {EmberArray} objects array whose content will be used for replacing
|
|
21549
21536
|
the content of the receiver
|
|
21550
21537
|
@return {EmberArray} receiver with the new content
|
|
@@ -21562,13 +21549,13 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21562
21549
|
|
|
21563
21550
|
/**
|
|
21564
21551
|
Remove all occurrences of an object in the array.
|
|
21565
|
-
|
|
21552
|
+
```javascript
|
|
21566
21553
|
let cities = ['Chicago', 'Berlin', 'Lima', 'Chicago'];
|
|
21567
|
-
|
|
21554
|
+
cities.removeObject('Chicago'); // ['Berlin', 'Lima']
|
|
21568
21555
|
cities.removeObject('Lima'); // ['Berlin']
|
|
21569
21556
|
cities.removeObject('Tokyo') // ['Berlin']
|
|
21570
21557
|
```
|
|
21571
|
-
|
|
21558
|
+
@method removeObject
|
|
21572
21559
|
@param {*} obj object to remove
|
|
21573
21560
|
@return {EmberArray} receiver
|
|
21574
21561
|
@public
|
|
@@ -21589,7 +21576,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21589
21576
|
|
|
21590
21577
|
/**
|
|
21591
21578
|
Removes each object in the passed array from the receiver.
|
|
21592
|
-
|
|
21579
|
+
@method removeObjects
|
|
21593
21580
|
@param {EmberArray} objects the objects to remove
|
|
21594
21581
|
@return {EmberArray} receiver
|
|
21595
21582
|
@public
|
|
@@ -21598,6 +21585,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21598
21585
|
(0, _metal.beginPropertyChanges)();
|
|
21599
21586
|
|
|
21600
21587
|
for (var i = objects.length - 1; i >= 0; i--) {
|
|
21588
|
+
// SAFETY: Due to the loop structure we know this will always exist.
|
|
21601
21589
|
this.removeObject(objects[i]);
|
|
21602
21590
|
}
|
|
21603
21591
|
|
|
@@ -21608,12 +21596,12 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21608
21596
|
/**
|
|
21609
21597
|
Push the object onto the end of the array if it is not already
|
|
21610
21598
|
present in the array.
|
|
21611
|
-
|
|
21599
|
+
```javascript
|
|
21612
21600
|
let cities = ['Chicago', 'Berlin'];
|
|
21613
|
-
|
|
21601
|
+
cities.addObject('Lima'); // ['Chicago', 'Berlin', 'Lima']
|
|
21614
21602
|
cities.addObject('Berlin'); // ['Chicago', 'Berlin', 'Lima']
|
|
21615
21603
|
```
|
|
21616
|
-
|
|
21604
|
+
@method addObject
|
|
21617
21605
|
@param {*} obj object to add, if not already present
|
|
21618
21606
|
@return {EmberArray} receiver
|
|
21619
21607
|
@public
|
|
@@ -21630,7 +21618,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21630
21618
|
|
|
21631
21619
|
/**
|
|
21632
21620
|
Adds each object in the passed array to the receiver.
|
|
21633
|
-
|
|
21621
|
+
@method addObjects
|
|
21634
21622
|
@param {EmberArray} objects the objects to add.
|
|
21635
21623
|
@return {EmberArray} receiver
|
|
21636
21624
|
@public
|
|
@@ -21643,62 +21631,6 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21643
21631
|
}
|
|
21644
21632
|
|
|
21645
21633
|
});
|
|
21646
|
-
/**
|
|
21647
|
-
Creates an `Ember.NativeArray` from an Array-like object.
|
|
21648
|
-
Does not modify the original object's contents. `A()` is not needed if
|
|
21649
|
-
`EmberENV.EXTEND_PROTOTYPES` is `true` (the default value). However,
|
|
21650
|
-
it is recommended that you use `A()` when creating addons for
|
|
21651
|
-
ember or when you can not guarantee that `EmberENV.EXTEND_PROTOTYPES`
|
|
21652
|
-
will be `true`.
|
|
21653
|
-
|
|
21654
|
-
Example
|
|
21655
|
-
|
|
21656
|
-
```app/components/my-component.js
|
|
21657
|
-
import Component from '@ember/component';
|
|
21658
|
-
import { A } from '@ember/array';
|
|
21659
|
-
|
|
21660
|
-
export default Component.extend({
|
|
21661
|
-
tagName: 'ul',
|
|
21662
|
-
classNames: ['pagination'],
|
|
21663
|
-
|
|
21664
|
-
init() {
|
|
21665
|
-
this._super(...arguments);
|
|
21666
|
-
|
|
21667
|
-
if (!this.get('content')) {
|
|
21668
|
-
this.set('content', A());
|
|
21669
|
-
this.set('otherContent', A([1,2,3]));
|
|
21670
|
-
}
|
|
21671
|
-
}
|
|
21672
|
-
});
|
|
21673
|
-
```
|
|
21674
|
-
|
|
21675
|
-
@method A
|
|
21676
|
-
@static
|
|
21677
|
-
@for @ember/array
|
|
21678
|
-
@return {Ember.NativeArray}
|
|
21679
|
-
@public
|
|
21680
|
-
*/
|
|
21681
|
-
// Add Ember.Array to Array.prototype. Remove methods with native
|
|
21682
|
-
// implementations and supply some more optimized versions of generic methods
|
|
21683
|
-
// because they are so common.
|
|
21684
|
-
|
|
21685
|
-
/**
|
|
21686
|
-
@module ember
|
|
21687
|
-
*/
|
|
21688
|
-
|
|
21689
|
-
/**
|
|
21690
|
-
The NativeArray mixin contains the properties needed to make the native
|
|
21691
|
-
Array support MutableArray and all of its dependent APIs. Unless you
|
|
21692
|
-
have `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Array` set to
|
|
21693
|
-
false, this will be applied automatically. Otherwise you can apply the mixin
|
|
21694
|
-
at anytime by calling `Ember.NativeArray.apply(Array.prototype)`.
|
|
21695
|
-
|
|
21696
|
-
@class Ember.NativeArray
|
|
21697
|
-
@uses MutableArray
|
|
21698
|
-
@uses Observable
|
|
21699
|
-
@public
|
|
21700
|
-
*/
|
|
21701
|
-
|
|
21702
21634
|
|
|
21703
21635
|
_exports.MutableArray = MutableArray;
|
|
21704
21636
|
|
|
@@ -21724,6 +21656,7 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21724
21656
|
_exports.NativeArray = NativeArray;
|
|
21725
21657
|
var ignore = ['length'];
|
|
21726
21658
|
NativeArray.keys().forEach(methodName => {
|
|
21659
|
+
// SAFETY: It's safe to read unknown properties from an object
|
|
21727
21660
|
if (Array.prototype[methodName]) {
|
|
21728
21661
|
ignore.push(methodName);
|
|
21729
21662
|
}
|
|
@@ -21736,22 +21669,25 @@ define("@ember/-internals/runtime/lib/mixins/array", ["exports", "@ember/-intern
|
|
|
21736
21669
|
NativeArray.apply(Array.prototype, true);
|
|
21737
21670
|
|
|
21738
21671
|
_exports.A = A = function (arr) {
|
|
21739
|
-
(true && !(!(this instanceof A)) && (0, _debug.assert)('You cannot create an Ember Array with `new A()`, please update to calling A as a function: `A()`', !(this instanceof A)));
|
|
21672
|
+
(true && !(!(this instanceof A)) && (0, _debug.assert)('You cannot create an Ember Array with `new A()`, please update to calling A as a function: `A()`', !(this instanceof A))); // SAFTEY: Since we are extending prototypes all true native arrays are Ember NativeArrays
|
|
21673
|
+
|
|
21740
21674
|
return arr || [];
|
|
21741
21675
|
};
|
|
21742
21676
|
} else {
|
|
21743
21677
|
_exports.A = A = function (arr) {
|
|
21744
21678
|
(true && !(!(this instanceof A)) && (0, _debug.assert)('You cannot create an Ember Array with `new A()`, please update to calling A as a function: `A()`', !(this instanceof A)));
|
|
21745
21679
|
|
|
21746
|
-
if (
|
|
21747
|
-
|
|
21680
|
+
if ((0, _utils.isEmberArray)(arr)) {
|
|
21681
|
+
// SAFETY: If it's a true native array and it is also an EmberArray then it should be an Ember NativeArray
|
|
21682
|
+
return arr;
|
|
21683
|
+
} else {
|
|
21684
|
+
// SAFETY: This will return an NativeArray but TS can't infer that.
|
|
21685
|
+
return NativeArray.apply(arr !== null && arr !== void 0 ? arr : []);
|
|
21748
21686
|
}
|
|
21749
|
-
|
|
21750
|
-
return ArrayMixin.detect(arr) ? arr : NativeArray.apply(arr);
|
|
21751
21687
|
};
|
|
21752
21688
|
}
|
|
21753
21689
|
|
|
21754
|
-
var _default =
|
|
21690
|
+
var _default = EmberArray;
|
|
21755
21691
|
_exports.default = _default;
|
|
21756
21692
|
});
|
|
21757
21693
|
define("@ember/-internals/runtime/lib/mixins/comparable", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
|
@@ -23059,7 +22995,7 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23059
22995
|
@method replaceContent
|
|
23060
22996
|
@param {Number} idx The starting index
|
|
23061
22997
|
@param {Number} amt The number of items to remove from the content.
|
|
23062
|
-
@param {
|
|
22998
|
+
@param {Array} objects Optional array of objects to insert.
|
|
23063
22999
|
@return {void}
|
|
23064
23000
|
@public
|
|
23065
23001
|
*/
|
|
@@ -23067,9 +23003,9 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23067
23003
|
|
|
23068
23004
|
replaceContent(idx, amt, objects) {
|
|
23069
23005
|
var content = (0, _metal.get)(this, 'content');
|
|
23070
|
-
(true && !(content) && (0, _debug.assert)('[BUG] Called
|
|
23006
|
+
(true && !(content) && (0, _debug.assert)('[BUG] Called replaceContent without content', content));
|
|
23071
23007
|
(true && !(isMutable(content)) && (0, _debug.assert)('Mutating a non-mutable array is not allowed', isMutable(content)));
|
|
23072
|
-
|
|
23008
|
+
(0, _metal.replace)(content, idx, amt, objects);
|
|
23073
23009
|
} // Overriding objectAt is not supported.
|
|
23074
23010
|
|
|
23075
23011
|
|
|
@@ -23158,7 +23094,12 @@ define("@ember/-internals/runtime/lib/system/array_proxy", ["exports", "@ember/-
|
|
|
23158
23094
|
if (arrangedContent && !arrangedContent.isDestroyed) {
|
|
23159
23095
|
// @ts-expect-error This check is still good for ensuring correctness
|
|
23160
23096
|
(true && !(arrangedContent !== this) && (0, _debug.assert)("Can't set ArrayProxy's content to itself", arrangedContent !== this));
|
|
23161
|
-
(true && !(
|
|
23097
|
+
(true && !(function (arr) {
|
|
23098
|
+
return Array.isArray(arr) || _array.default.detect(arr);
|
|
23099
|
+
}(arrangedContent)) && (0, _debug.assert)(`ArrayProxy expects a native Array, EmberArray, or ArrayProxy, but you passed ${typeof arrangedContent}`, function (arr) {
|
|
23100
|
+
return Array.isArray(arr) || _array.default.detect(arr);
|
|
23101
|
+
}(arrangedContent)));
|
|
23102
|
+
(true && !(!arrangedContent.isDestroyed) && (0, _debug.assert)('ArrayProxy expected its contents to not be destroyed', !arrangedContent.isDestroyed));
|
|
23162
23103
|
(0, _metal.addArrayObserver)(arrangedContent, this, ARRAY_OBSERVER_MAPPING);
|
|
23163
23104
|
this._arrangedContent = arrangedContent;
|
|
23164
23105
|
}
|
|
@@ -28121,6 +28062,9 @@ define("@ember/application/lib/application", ["exports", "@ember/-internals/util
|
|
|
28121
28062
|
|
|
28122
28063
|
}
|
|
28123
28064
|
|
|
28065
|
+
Application.initializer = (0, _engine.buildInitializerMethod)('initializers', 'initializer');
|
|
28066
|
+
Application.instanceInitializer = (0, _engine.buildInitializerMethod)('instanceInitializers', 'instance initializer');
|
|
28067
|
+
|
|
28124
28068
|
function commonSetupRegistry(registry) {
|
|
28125
28069
|
registry.register('router:main', _routing.Router);
|
|
28126
28070
|
registry.register('-view-registry:main', {
|
|
@@ -29613,6 +29557,7 @@ define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@e
|
|
|
29613
29557
|
Object.defineProperty(_exports, "__esModule", {
|
|
29614
29558
|
value: true
|
|
29615
29559
|
});
|
|
29560
|
+
_exports.buildInitializerMethod = buildInitializerMethod;
|
|
29616
29561
|
_exports.default = void 0;
|
|
29617
29562
|
Object.defineProperty(_exports, "getEngineParent", {
|
|
29618
29563
|
enumerable: true,
|
|
@@ -30038,6 +29983,8 @@ define("@ember/engine/index", ["exports", "@ember/engine/lib/engine-parent", "@e
|
|
|
30038
29983
|
};
|
|
30039
29984
|
return ResolverClass.create(props);
|
|
30040
29985
|
}
|
|
29986
|
+
/** @internal */
|
|
29987
|
+
|
|
30041
29988
|
|
|
30042
29989
|
function buildInitializerMethod(bucketName, humanName) {
|
|
30043
29990
|
return function (initializer) {
|
|
@@ -31234,8 +31181,12 @@ define("@ember/object/index", ["exports", "@ember/debug", "@ember/-internals/met
|
|
|
31234
31181
|
*/
|
|
31235
31182
|
var BINDINGS_MAP = new WeakMap();
|
|
31236
31183
|
|
|
31184
|
+
function hasProto(obj) {
|
|
31185
|
+
return obj != null && obj.constructor !== undefined && typeof obj.constructor.proto === 'function';
|
|
31186
|
+
}
|
|
31187
|
+
|
|
31237
31188
|
function setupAction(target, key, actionFn) {
|
|
31238
|
-
if (target
|
|
31189
|
+
if (hasProto(target)) {
|
|
31239
31190
|
target.constructor.proto();
|
|
31240
31191
|
}
|
|
31241
31192
|
|
|
@@ -31245,6 +31196,7 @@ define("@ember/object/index", ["exports", "@ember/debug", "@ember/-internals/met
|
|
|
31245
31196
|
target.actions = parentActions ? Object.assign({}, parentActions) : {};
|
|
31246
31197
|
}
|
|
31247
31198
|
|
|
31199
|
+
(true && !(target.actions != null) && (0, _debug.assert)("[BUG] Somehow the target doesn't have actions!", target.actions != null));
|
|
31248
31200
|
target.actions[key] = actionFn;
|
|
31249
31201
|
return {
|
|
31250
31202
|
get() {
|
|
@@ -31268,13 +31220,17 @@ define("@ember/object/index", ["exports", "@ember/debug", "@ember/-internals/met
|
|
|
31268
31220
|
};
|
|
31269
31221
|
}
|
|
31270
31222
|
|
|
31271
|
-
function action(
|
|
31223
|
+
function action() {
|
|
31272
31224
|
var actionFn;
|
|
31273
31225
|
|
|
31274
|
-
|
|
31275
|
-
|
|
31226
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
31227
|
+
args[_key] = arguments[_key];
|
|
31228
|
+
}
|
|
31276
31229
|
|
|
31277
|
-
|
|
31230
|
+
if (!(0, _metal.isElementDescriptor)(args)) {
|
|
31231
|
+
actionFn = args[0];
|
|
31232
|
+
|
|
31233
|
+
var decorator = function (target, key, _desc, _meta, isClassicDecorator) {
|
|
31278
31234
|
(true && !(isClassicDecorator) && (0, _debug.assert)('The @action decorator may only be passed a method when used in classic classes. You should decorate methods directly in native classes', isClassicDecorator));
|
|
31279
31235
|
(true && !(typeof actionFn === 'function') && (0, _debug.assert)('The action() decorator must be passed a method when used in classic classes', typeof actionFn === 'function'));
|
|
31280
31236
|
return setupAction(target, key, actionFn);
|
|
@@ -31284,10 +31240,13 @@ define("@ember/object/index", ["exports", "@ember/debug", "@ember/-internals/met
|
|
|
31284
31240
|
return decorator;
|
|
31285
31241
|
}
|
|
31286
31242
|
|
|
31287
|
-
|
|
31288
|
-
|
|
31243
|
+
var [target, key, desc] = args;
|
|
31244
|
+
actionFn = desc === null || desc === void 0 ? void 0 : desc.value;
|
|
31245
|
+
(true && !(typeof actionFn === 'function') && (0, _debug.assert)('The @action decorator must be applied to methods when used in native classes', typeof actionFn === 'function')); // SAFETY: TS types are weird with decorators. This should work.
|
|
31246
|
+
|
|
31289
31247
|
return setupAction(target, key, actionFn);
|
|
31290
|
-
}
|
|
31248
|
+
} // SAFETY: TS types are weird with decorators. This should work.
|
|
31249
|
+
|
|
31291
31250
|
|
|
31292
31251
|
(0, _metal.setClassicDecorator)(action);
|
|
31293
31252
|
});
|
|
@@ -32795,7 +32754,7 @@ define("@ember/object/lib/computed/reduce_computed_macros", ["exports", "@ember/
|
|
|
32795
32754
|
}
|
|
32796
32755
|
|
|
32797
32756
|
if (!isNativeOrEmberArray(setB)) {
|
|
32798
|
-
return
|
|
32757
|
+
return setA;
|
|
32799
32758
|
}
|
|
32800
32759
|
|
|
32801
32760
|
return setA.filter(x => setB.indexOf(x) === -1);
|
|
@@ -34417,7 +34376,7 @@ define("@ember/test/adapter", ["exports", "ember-testing"], function (_exports,
|
|
|
34417
34376
|
value: true
|
|
34418
34377
|
});
|
|
34419
34378
|
_exports.default = void 0;
|
|
34420
|
-
var _default = _emberTesting.
|
|
34379
|
+
var _default = _emberTesting.Adapter;
|
|
34421
34380
|
_exports.default = _default;
|
|
34422
34381
|
});
|
|
34423
34382
|
define("@ember/test/index", ["exports", "require"], function (_exports, _require) {
|
|
@@ -52325,30 +52284,19 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
|
|
|
52325
52284
|
});
|
|
52326
52285
|
_exports.default = void 0;
|
|
52327
52286
|
|
|
52328
|
-
|
|
52329
|
-
@module @ember/test
|
|
52330
|
-
*/
|
|
52331
|
-
|
|
52332
|
-
/**
|
|
52333
|
-
The primary purpose of this class is to create hooks that can be implemented
|
|
52334
|
-
by an adapter for various test frameworks.
|
|
52335
|
-
|
|
52336
|
-
@class TestAdapter
|
|
52337
|
-
@public
|
|
52338
|
-
*/
|
|
52339
|
-
var _default = _runtime.Object.extend({
|
|
52287
|
+
var Adapter = _runtime.Object.extend({
|
|
52340
52288
|
/**
|
|
52341
52289
|
This callback will be called whenever an async operation is about to start.
|
|
52342
|
-
|
|
52290
|
+
Override this to call your framework's methods that handle async
|
|
52343
52291
|
operations.
|
|
52344
|
-
|
|
52292
|
+
@public
|
|
52345
52293
|
@method asyncStart
|
|
52346
52294
|
*/
|
|
52347
52295
|
asyncStart() {},
|
|
52348
52296
|
|
|
52349
52297
|
/**
|
|
52350
52298
|
This callback will be called whenever an async operation has completed.
|
|
52351
|
-
|
|
52299
|
+
@public
|
|
52352
52300
|
@method asyncEnd
|
|
52353
52301
|
*/
|
|
52354
52302
|
asyncEnd() {},
|
|
@@ -52357,13 +52305,13 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
|
|
|
52357
52305
|
Override this method with your testing framework's false assertion.
|
|
52358
52306
|
This function is called whenever an exception occurs causing the testing
|
|
52359
52307
|
promise to fail.
|
|
52360
|
-
|
|
52361
|
-
|
|
52308
|
+
QUnit example:
|
|
52309
|
+
```javascript
|
|
52362
52310
|
exception: function(error) {
|
|
52363
52311
|
ok(false, error);
|
|
52364
52312
|
};
|
|
52365
52313
|
```
|
|
52366
|
-
|
|
52314
|
+
@public
|
|
52367
52315
|
@method exception
|
|
52368
52316
|
@param {String} error The exception to be raised.
|
|
52369
52317
|
*/
|
|
@@ -52373,6 +52321,7 @@ define("ember-testing/lib/adapters/adapter", ["exports", "@ember/-internals/runt
|
|
|
52373
52321
|
|
|
52374
52322
|
});
|
|
52375
52323
|
|
|
52324
|
+
var _default = Adapter;
|
|
52376
52325
|
_exports.default = _default;
|
|
52377
52326
|
});
|
|
52378
52327
|
define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils", "ember-testing/lib/adapters/adapter"], function (_exports, _utils, _adapter) {
|
|
@@ -52384,27 +52333,17 @@ define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils"
|
|
|
52384
52333
|
_exports.default = void 0;
|
|
52385
52334
|
|
|
52386
52335
|
/* globals QUnit */
|
|
52336
|
+
function isVeryOldQunit(obj) {
|
|
52337
|
+
return obj != null && typeof obj.stop === 'function';
|
|
52338
|
+
}
|
|
52387
52339
|
|
|
52388
|
-
|
|
52389
|
-
@module ember
|
|
52390
|
-
*/
|
|
52391
|
-
|
|
52392
|
-
/**
|
|
52393
|
-
This class implements the methods defined by TestAdapter for the
|
|
52394
|
-
QUnit testing framework.
|
|
52395
|
-
|
|
52396
|
-
@class QUnitAdapter
|
|
52397
|
-
@namespace Ember.Test
|
|
52398
|
-
@extends TestAdapter
|
|
52399
|
-
@public
|
|
52400
|
-
*/
|
|
52401
|
-
var _default = _adapter.default.extend({
|
|
52340
|
+
var QUnitAdapter = _adapter.default.extend({
|
|
52402
52341
|
init() {
|
|
52403
52342
|
this.doneCallbacks = [];
|
|
52404
52343
|
},
|
|
52405
52344
|
|
|
52406
52345
|
asyncStart() {
|
|
52407
|
-
if (
|
|
52346
|
+
if (isVeryOldQunit(QUnit)) {
|
|
52408
52347
|
// very old QUnit version
|
|
52409
52348
|
// eslint-disable-next-line qunit/no-qunit-stop
|
|
52410
52349
|
QUnit.stop();
|
|
@@ -52417,7 +52356,7 @@ define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils"
|
|
|
52417
52356
|
// checking for QUnit.stop here (even though we _need_ QUnit.start) because
|
|
52418
52357
|
// QUnit.start() still exists in QUnit 2.x (it just throws an error when calling
|
|
52419
52358
|
// inside a test context)
|
|
52420
|
-
if (
|
|
52359
|
+
if (isVeryOldQunit(QUnit)) {
|
|
52421
52360
|
QUnit.start();
|
|
52422
52361
|
} else {
|
|
52423
52362
|
var done = this.doneCallbacks.pop(); // This can be null if asyncStart() was called outside of a test
|
|
@@ -52434,9 +52373,10 @@ define("ember-testing/lib/adapters/qunit", ["exports", "@ember/-internals/utils"
|
|
|
52434
52373
|
|
|
52435
52374
|
});
|
|
52436
52375
|
|
|
52376
|
+
var _default = QUnitAdapter;
|
|
52437
52377
|
_exports.default = _default;
|
|
52438
52378
|
});
|
|
52439
|
-
define("ember-testing/lib/ext/application", ["@ember/application", "ember-testing/lib/setup_for_testing", "ember-testing/lib/test/helpers", "ember-testing/lib/test/promise", "ember-testing/lib/test/run", "ember-testing/lib/test/on_inject_helpers", "ember-testing/lib/test/adapter"], function (_application, _setup_for_testing, _helpers, _promise, _run, _on_inject_helpers, _adapter) {
|
|
52379
|
+
define("ember-testing/lib/ext/application", ["@ember/application", "ember-testing/lib/setup_for_testing", "ember-testing/lib/test/helpers", "ember-testing/lib/test/promise", "ember-testing/lib/test/run", "ember-testing/lib/test/on_inject_helpers", "ember-testing/lib/test/adapter", "@ember/debug"], function (_application, _setup_for_testing, _helpers, _promise, _run, _on_inject_helpers, _adapter, _debug) {
|
|
52440
52380
|
"use strict";
|
|
52441
52381
|
|
|
52442
52382
|
_application.default.reopen({
|
|
@@ -52445,7 +52385,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52445
52385
|
are created once you call `injectTestHelpers` on your `Application`
|
|
52446
52386
|
instance. The included helpers are also available on the `window` object by
|
|
52447
52387
|
default, but can be used from this object on the individual application also.
|
|
52448
|
-
|
|
52388
|
+
@property testHelpers
|
|
52449
52389
|
@type {Object}
|
|
52450
52390
|
@default {}
|
|
52451
52391
|
@public
|
|
@@ -52455,9 +52395,9 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52455
52395
|
/**
|
|
52456
52396
|
This property will contain the original methods that were registered
|
|
52457
52397
|
on the `helperContainer` before `injectTestHelpers` is called.
|
|
52458
|
-
|
|
52398
|
+
When `removeTestHelpers` is called, these methods are restored to the
|
|
52459
52399
|
`helperContainer`.
|
|
52460
|
-
|
|
52400
|
+
@property originalMethods
|
|
52461
52401
|
@type {Object}
|
|
52462
52402
|
@default {}
|
|
52463
52403
|
@private
|
|
@@ -52469,7 +52409,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52469
52409
|
This property indicates whether or not this application is currently in
|
|
52470
52410
|
testing mode. This is set when `setupForTesting` is called on the current
|
|
52471
52411
|
application.
|
|
52472
|
-
|
|
52412
|
+
@property testing
|
|
52473
52413
|
@type {Boolean}
|
|
52474
52414
|
@default false
|
|
52475
52415
|
@since 1.3.0
|
|
@@ -52484,11 +52424,11 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52484
52424
|
(preventing both accidental leaking of state between tests and interference
|
|
52485
52425
|
with your testing framework). `setupForTesting` should only be called after
|
|
52486
52426
|
setting a custom `router` class (for example `App.Router = Router.extend(`).
|
|
52487
|
-
|
|
52488
|
-
|
|
52427
|
+
Example:
|
|
52428
|
+
```
|
|
52489
52429
|
App.setupForTesting();
|
|
52490
52430
|
```
|
|
52491
|
-
|
|
52431
|
+
@method setupForTesting
|
|
52492
52432
|
@public
|
|
52493
52433
|
*/
|
|
52494
52434
|
setupForTesting() {
|
|
@@ -52502,7 +52442,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52502
52442
|
/**
|
|
52503
52443
|
This will be used as the container to inject the test helpers into. By
|
|
52504
52444
|
default the helpers are injected into `window`.
|
|
52505
|
-
|
|
52445
|
+
@property helperContainer
|
|
52506
52446
|
@type {Object} The object to be used for test helpers.
|
|
52507
52447
|
@default window
|
|
52508
52448
|
@since 1.2.0
|
|
@@ -52516,13 +52456,13 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52516
52456
|
to `window`. If a function of the same name has already been defined it will be cached
|
|
52517
52457
|
(so that it can be reset if the helper is removed with `unregisterHelper` or
|
|
52518
52458
|
`removeTestHelpers`).
|
|
52519
|
-
|
|
52459
|
+
Any callbacks registered with `onInjectHelpers` will be called once the
|
|
52520
52460
|
helpers have been injected.
|
|
52521
|
-
|
|
52461
|
+
Example:
|
|
52522
52462
|
```
|
|
52523
52463
|
App.injectTestHelpers();
|
|
52524
52464
|
```
|
|
52525
|
-
|
|
52465
|
+
@method injectTestHelpers
|
|
52526
52466
|
@public
|
|
52527
52467
|
*/
|
|
52528
52468
|
injectTestHelpers(helperContainer) {
|
|
@@ -52543,8 +52483,11 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52543
52483
|
this.testHelpers = {};
|
|
52544
52484
|
|
|
52545
52485
|
for (var name in _helpers.helpers) {
|
|
52546
|
-
|
|
52547
|
-
this.
|
|
52486
|
+
// SAFETY: It is safe to access a property on an object
|
|
52487
|
+
this.originalMethods[name] = this.helperContainer[name]; // SAFETY: It is not quite as safe to do this, but it _seems_ to be ok.
|
|
52488
|
+
|
|
52489
|
+
this.testHelpers[name] = this.helperContainer[name] = helper(this, name); // SAFETY: We checked that it exists
|
|
52490
|
+
|
|
52548
52491
|
protoWrap(_promise.default.prototype, name, helper(this, name), _helpers.helpers[name].meta.wait);
|
|
52549
52492
|
}
|
|
52550
52493
|
|
|
@@ -52554,11 +52497,11 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52554
52497
|
/**
|
|
52555
52498
|
This removes all helpers that have been registered, and resets and functions
|
|
52556
52499
|
that were overridden by the helpers.
|
|
52557
|
-
|
|
52558
|
-
|
|
52500
|
+
Example:
|
|
52501
|
+
```javascript
|
|
52559
52502
|
App.removeTestHelpers();
|
|
52560
52503
|
```
|
|
52561
|
-
|
|
52504
|
+
@public
|
|
52562
52505
|
@method removeTestHelpers
|
|
52563
52506
|
*/
|
|
52564
52507
|
removeTestHelpers() {
|
|
@@ -52567,7 +52510,8 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52567
52510
|
}
|
|
52568
52511
|
|
|
52569
52512
|
for (var name in _helpers.helpers) {
|
|
52570
|
-
this.helperContainer[name] = this.originalMethods[name];
|
|
52513
|
+
this.helperContainer[name] = this.originalMethods[name]; // SAFETY: This is a weird thing, but it's not technically unsafe here.
|
|
52514
|
+
|
|
52571
52515
|
delete _promise.default.prototype[name];
|
|
52572
52516
|
delete this.testHelpers[name];
|
|
52573
52517
|
delete this.originalMethods[name];
|
|
@@ -52580,6 +52524,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52580
52524
|
|
|
52581
52525
|
|
|
52582
52526
|
function protoWrap(proto, name, callback, isAsync) {
|
|
52527
|
+
// SAFETY: This isn't entirely safe, but it _seems_ to be ok.
|
|
52583
52528
|
proto[name] = function () {
|
|
52584
52529
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
52585
52530
|
args[_key] = arguments[_key];
|
|
@@ -52588,6 +52533,7 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52588
52533
|
if (isAsync) {
|
|
52589
52534
|
return callback.apply(this, args);
|
|
52590
52535
|
} else {
|
|
52536
|
+
// SAFETY: This is not actually safe.
|
|
52591
52537
|
return this.then(function () {
|
|
52592
52538
|
return callback.apply(this, args);
|
|
52593
52539
|
});
|
|
@@ -52596,8 +52542,10 @@ define("ember-testing/lib/ext/application", ["@ember/application", "ember-testin
|
|
|
52596
52542
|
}
|
|
52597
52543
|
|
|
52598
52544
|
function helper(app, name) {
|
|
52599
|
-
var
|
|
52600
|
-
|
|
52545
|
+
var helper = _helpers.helpers[name];
|
|
52546
|
+
(true && !(helper) && (0, _debug.assert)(`[BUG] Missing helper: ${name}`, helper));
|
|
52547
|
+
var fn = helper.method;
|
|
52548
|
+
var meta = helper.meta;
|
|
52601
52549
|
|
|
52602
52550
|
if (!meta.wait) {
|
|
52603
52551
|
return function () {
|
|
@@ -52661,7 +52609,7 @@ define("ember-testing/lib/helpers", ["ember-testing/lib/test/helpers", "ember-te
|
|
|
52661
52609
|
(0, _helpers.registerHelper)('currentURL', _current_url.default);
|
|
52662
52610
|
(0, _helpers.registerHelper)('resumeTest', _pause_test.resumeTest);
|
|
52663
52611
|
});
|
|
52664
|
-
define("ember-testing/lib/helpers/and_then", ["exports"], function (_exports) {
|
|
52612
|
+
define("ember-testing/lib/helpers/and_then", ["exports", "@ember/debug"], function (_exports, _debug) {
|
|
52665
52613
|
"use strict";
|
|
52666
52614
|
|
|
52667
52615
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -52670,10 +52618,12 @@ define("ember-testing/lib/helpers/and_then", ["exports"], function (_exports) {
|
|
|
52670
52618
|
_exports.default = andThen;
|
|
52671
52619
|
|
|
52672
52620
|
function andThen(app, callback) {
|
|
52673
|
-
|
|
52621
|
+
var wait = app.testHelpers['wait'];
|
|
52622
|
+
(true && !(wait) && (0, _debug.assert)('[BUG] Missing wait helper', wait));
|
|
52623
|
+
return wait(callback(app));
|
|
52674
52624
|
}
|
|
52675
52625
|
});
|
|
52676
|
-
define("ember-testing/lib/helpers/current_path", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
|
52626
|
+
define("ember-testing/lib/helpers/current_path", ["exports", "@ember/-internals/metal", "@ember/-internals/routing", "@ember/debug"], function (_exports, _metal, _routing, _debug) {
|
|
52677
52627
|
"use strict";
|
|
52678
52628
|
|
|
52679
52629
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -52704,12 +52654,15 @@ define("ember-testing/lib/helpers/current_path", ["exports", "@ember/-internals/
|
|
|
52704
52654
|
@public
|
|
52705
52655
|
*/
|
|
52706
52656
|
function currentPath(app) {
|
|
52657
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] app.__container__ is not set', app.__container__));
|
|
52658
|
+
|
|
52707
52659
|
var routingService = app.__container__.lookup('service:-routing');
|
|
52708
52660
|
|
|
52661
|
+
(true && !(routingService instanceof _routing.RoutingService) && (0, _debug.assert)('[BUG] service:-routing is not a RoutingService', routingService instanceof _routing.RoutingService));
|
|
52709
52662
|
return (0, _metal.get)(routingService, 'currentPath');
|
|
52710
52663
|
}
|
|
52711
52664
|
});
|
|
52712
|
-
define("ember-testing/lib/helpers/current_route_name", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
|
52665
|
+
define("ember-testing/lib/helpers/current_route_name", ["exports", "@ember/-internals/metal", "@ember/-internals/routing", "@ember/debug"], function (_exports, _metal, _routing, _debug) {
|
|
52713
52666
|
"use strict";
|
|
52714
52667
|
|
|
52715
52668
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -52739,12 +52692,15 @@ define("ember-testing/lib/helpers/current_route_name", ["exports", "@ember/-inte
|
|
|
52739
52692
|
@public
|
|
52740
52693
|
*/
|
|
52741
52694
|
function currentRouteName(app) {
|
|
52695
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] app.__container__ is not set', app.__container__));
|
|
52696
|
+
|
|
52742
52697
|
var routingService = app.__container__.lookup('service:-routing');
|
|
52743
52698
|
|
|
52699
|
+
(true && !(routingService instanceof _routing.RoutingService) && (0, _debug.assert)('[BUG] service:-routing is not a RoutingService', routingService instanceof _routing.RoutingService));
|
|
52744
52700
|
return (0, _metal.get)(routingService, 'currentRouteName');
|
|
52745
52701
|
}
|
|
52746
52702
|
});
|
|
52747
|
-
define("ember-testing/lib/helpers/current_url", ["exports", "@ember/-internals/metal"], function (_exports, _metal) {
|
|
52703
|
+
define("ember-testing/lib/helpers/current_url", ["exports", "@ember/-internals/metal", "@ember/debug", "@ember/routing/router"], function (_exports, _metal, _debug, _router) {
|
|
52748
52704
|
"use strict";
|
|
52749
52705
|
|
|
52750
52706
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -52775,9 +52731,14 @@ define("ember-testing/lib/helpers/current_url", ["exports", "@ember/-internals/m
|
|
|
52775
52731
|
@public
|
|
52776
52732
|
*/
|
|
52777
52733
|
function currentURL(app) {
|
|
52734
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] app.__container__ is not set', app.__container__));
|
|
52735
|
+
|
|
52778
52736
|
var router = app.__container__.lookup('router:main');
|
|
52779
52737
|
|
|
52780
|
-
|
|
52738
|
+
(true && !(router instanceof _router.default) && (0, _debug.assert)('[BUG] router:main is not a Router', router instanceof _router.default));
|
|
52739
|
+
var location = (0, _metal.get)(router, 'location');
|
|
52740
|
+
(true && !(typeof location !== 'string') && (0, _debug.assert)('[BUG] location is still a string', typeof location !== 'string'));
|
|
52741
|
+
return location.getURL();
|
|
52781
52742
|
}
|
|
52782
52743
|
});
|
|
52783
52744
|
define("ember-testing/lib/helpers/pause_test", ["exports", "@ember/-internals/runtime", "@ember/debug"], function (_exports, _runtime, _debug) {
|
|
@@ -52852,7 +52813,7 @@ define("ember-testing/lib/helpers/pause_test", ["exports", "@ember/-internals/ru
|
|
|
52852
52813
|
}, 'TestAdapter paused promise');
|
|
52853
52814
|
}
|
|
52854
52815
|
});
|
|
52855
|
-
define("ember-testing/lib/helpers/visit", ["exports", "@ember/runloop"], function (_exports, _runloop) {
|
|
52816
|
+
define("ember-testing/lib/helpers/visit", ["exports", "@ember/debug", "@ember/routing/router", "@ember/runloop"], function (_exports, _debug, _router, _runloop) {
|
|
52856
52817
|
"use strict";
|
|
52857
52818
|
|
|
52858
52819
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -52879,18 +52840,24 @@ define("ember-testing/lib/helpers/visit", ["exports", "@ember/runloop"], functio
|
|
|
52879
52840
|
@public
|
|
52880
52841
|
*/
|
|
52881
52842
|
function visit(app, url) {
|
|
52843
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] Missing container', app.__container__));
|
|
52844
|
+
|
|
52882
52845
|
var router = app.__container__.lookup('router:main');
|
|
52883
52846
|
|
|
52847
|
+
(true && !(router instanceof _router.default) && (0, _debug.assert)('[BUG] router:main is not a Router', router instanceof _router.default));
|
|
52884
52848
|
var shouldHandleURL = false;
|
|
52885
52849
|
app.boot().then(() => {
|
|
52850
|
+
(true && !(typeof router.location !== 'string') && (0, _debug.assert)('[BUG] router.location is still a string', typeof router.location !== 'string'));
|
|
52886
52851
|
router.location.setURL(url);
|
|
52887
52852
|
|
|
52888
52853
|
if (shouldHandleURL) {
|
|
52854
|
+
(true && !(app.__deprecatedInstance__) && (0, _debug.assert)("[BUG] __deprecatedInstance__ isn't set", app.__deprecatedInstance__));
|
|
52889
52855
|
(0, _runloop.run)(app.__deprecatedInstance__, 'handleURL', url);
|
|
52890
52856
|
}
|
|
52891
52857
|
});
|
|
52892
52858
|
|
|
52893
52859
|
if (app._readinessDeferrals > 0) {
|
|
52860
|
+
// SAFETY: This should be safe, though it is odd.
|
|
52894
52861
|
router.initialURL = url;
|
|
52895
52862
|
(0, _runloop.run)(app, 'advanceReadiness');
|
|
52896
52863
|
delete router.initialURL;
|
|
@@ -52898,10 +52865,12 @@ define("ember-testing/lib/helpers/visit", ["exports", "@ember/runloop"], functio
|
|
|
52898
52865
|
shouldHandleURL = true;
|
|
52899
52866
|
}
|
|
52900
52867
|
|
|
52901
|
-
|
|
52868
|
+
var wait = app.testHelpers['wait'];
|
|
52869
|
+
(true && !(wait) && (0, _debug.assert)('[BUG] missing wait helper', wait));
|
|
52870
|
+
return wait();
|
|
52902
52871
|
}
|
|
52903
52872
|
});
|
|
52904
|
-
define("ember-testing/lib/helpers/wait", ["exports", "ember-testing/lib/test/waiters", "@ember/-internals/runtime", "@ember/runloop", "ember-testing/lib/test/pending_requests"], function (_exports, _waiters, _runtime, _runloop, _pending_requests) {
|
|
52873
|
+
define("ember-testing/lib/helpers/wait", ["exports", "ember-testing/lib/test/waiters", "@ember/-internals/runtime", "@ember/runloop", "ember-testing/lib/test/pending_requests", "@ember/debug", "@ember/routing/router"], function (_exports, _waiters, _runtime, _runloop, _pending_requests, _debug, _router) {
|
|
52905
52874
|
"use strict";
|
|
52906
52875
|
|
|
52907
52876
|
Object.defineProperty(_exports, "__esModule", {
|
|
@@ -52945,8 +52914,11 @@ define("ember-testing/lib/helpers/wait", ["exports", "ember-testing/lib/test/wai
|
|
|
52945
52914
|
*/
|
|
52946
52915
|
function wait(app, value) {
|
|
52947
52916
|
return new _runtime.RSVP.Promise(function (resolve) {
|
|
52948
|
-
|
|
52917
|
+
(true && !(app.__container__) && (0, _debug.assert)('[BUG] Missing container', app.__container__));
|
|
52918
|
+
|
|
52919
|
+
var router = app.__container__.lookup('router:main');
|
|
52949
52920
|
|
|
52921
|
+
(true && !(router instanceof _router.default) && (0, _debug.assert)('[BUG] Expected router:main to be a subclass of Ember Router', router instanceof _router.default)); // Every 10ms, poll for the async thing to have finished
|
|
52950
52922
|
|
|
52951
52923
|
var watcher = setInterval(() => {
|
|
52952
52924
|
// 1. If the router is loading, keep polling
|
|
@@ -52982,9 +52954,9 @@ define("ember-testing/lib/initializers", ["@ember/application"], function (_appl
|
|
|
52982
52954
|
"use strict";
|
|
52983
52955
|
|
|
52984
52956
|
var name = 'deferReadiness in `testing` mode';
|
|
52985
|
-
(0, _application.onLoad)('Ember.Application', function (
|
|
52986
|
-
if (!
|
|
52987
|
-
|
|
52957
|
+
(0, _application.onLoad)('Ember.Application', function (ApplicationClass) {
|
|
52958
|
+
if (!ApplicationClass.initializers[name]) {
|
|
52959
|
+
ApplicationClass.initializer({
|
|
52988
52960
|
name: name,
|
|
52989
52961
|
|
|
52990
52962
|
initialize(application) {
|
|
@@ -53055,7 +53027,7 @@ define("ember-testing/lib/test", ["exports", "ember-testing/lib/test/helpers", "
|
|
|
53055
53027
|
var Test = {
|
|
53056
53028
|
/**
|
|
53057
53029
|
Hash containing all known test helpers.
|
|
53058
|
-
|
|
53030
|
+
@property _helpers
|
|
53059
53031
|
@private
|
|
53060
53032
|
@since 1.7.0
|
|
53061
53033
|
*/
|
|
@@ -53138,7 +53110,8 @@ define("ember-testing/lib/test/adapter", ["exports", "@ember/-internals/error-ha
|
|
|
53138
53110
|
}
|
|
53139
53111
|
|
|
53140
53112
|
function adapterDispatch(error) {
|
|
53141
|
-
adapter.exception(error);
|
|
53113
|
+
adapter.exception(error); // @ts-expect-error Normally unreachable
|
|
53114
|
+
|
|
53142
53115
|
console.error(error.stack); // eslint-disable-line no-console
|
|
53143
53116
|
}
|
|
53144
53117
|
});
|
|
@@ -53281,7 +53254,9 @@ define("ember-testing/lib/test/helpers", ["exports", "ember-testing/lib/test/pro
|
|
|
53281
53254
|
|
|
53282
53255
|
|
|
53283
53256
|
function unregisterHelper(name) {
|
|
53284
|
-
delete helpers[name];
|
|
53257
|
+
delete helpers[name]; // SAFETY: This isn't necessarily a safe thing to do, but in terms of the immediate types here
|
|
53258
|
+
// it won't error.
|
|
53259
|
+
|
|
53285
53260
|
delete _promise.default.prototype[name];
|
|
53286
53261
|
}
|
|
53287
53262
|
});
|
|
@@ -53330,8 +53305,8 @@ define("ember-testing/lib/test/on_inject_helpers", ["exports"], function (_expor
|
|
|
53330
53305
|
}
|
|
53331
53306
|
|
|
53332
53307
|
function invokeInjectHelpersCallbacks(app) {
|
|
53333
|
-
for (var
|
|
53334
|
-
|
|
53308
|
+
for (var callback of callbacks) {
|
|
53309
|
+
callback(app);
|
|
53335
53310
|
}
|
|
53336
53311
|
}
|
|
53337
53312
|
});
|
|
@@ -53380,22 +53355,17 @@ define("ember-testing/lib/test/promise", ["exports", "@ember/-internals/runtime"
|
|
|
53380
53355
|
_exports.getLastPromise = getLastPromise;
|
|
53381
53356
|
_exports.promise = promise;
|
|
53382
53357
|
_exports.resolve = resolve;
|
|
53383
|
-
var lastPromise;
|
|
53358
|
+
var lastPromise = null;
|
|
53384
53359
|
|
|
53385
53360
|
class TestPromise extends _runtime.RSVP.Promise {
|
|
53386
|
-
constructor() {
|
|
53387
|
-
super(
|
|
53361
|
+
constructor(executor, label) {
|
|
53362
|
+
super(executor, label);
|
|
53388
53363
|
lastPromise = this;
|
|
53389
53364
|
}
|
|
53390
53365
|
|
|
53391
|
-
then(
|
|
53392
|
-
var
|
|
53393
|
-
|
|
53394
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
53395
|
-
args[_key - 1] = arguments[_key];
|
|
53396
|
-
}
|
|
53397
|
-
|
|
53398
|
-
return super.then(onFulfillment, ...args);
|
|
53366
|
+
then(onFulfilled, onRejected, label) {
|
|
53367
|
+
var normalizedOnFulfilled = typeof onFulfilled === 'function' ? result => isolate(onFulfilled, result) : undefined;
|
|
53368
|
+
return super.then(normalizedOnFulfilled, onRejected, label);
|
|
53399
53369
|
}
|
|
53400
53370
|
|
|
53401
53371
|
}
|
|
@@ -53447,10 +53417,10 @@ define("ember-testing/lib/test/promise", ["exports", "@ember/-internals/runtime"
|
|
|
53447
53417
|
// 3. Return the last promise created during method
|
|
53448
53418
|
|
|
53449
53419
|
|
|
53450
|
-
function isolate(
|
|
53420
|
+
function isolate(onFulfilled, result) {
|
|
53451
53421
|
// Reset lastPromise for nested helpers
|
|
53452
53422
|
lastPromise = null;
|
|
53453
|
-
var value =
|
|
53423
|
+
var value = onFulfilled(result);
|
|
53454
53424
|
var promise = lastPromise;
|
|
53455
53425
|
lastPromise = null; // If the method returned a promise
|
|
53456
53426
|
// return that promise. If not,
|
|
@@ -53494,55 +53464,25 @@ define("ember-testing/lib/test/waiters", ["exports"], function (_exports) {
|
|
|
53494
53464
|
*/
|
|
53495
53465
|
var contexts = [];
|
|
53496
53466
|
var callbacks = [];
|
|
53497
|
-
/**
|
|
53498
|
-
This allows ember-testing to play nicely with other asynchronous
|
|
53499
|
-
events, such as an application that is waiting for a CSS3
|
|
53500
|
-
transition or an IndexDB transaction. The waiter runs periodically
|
|
53501
|
-
after each async helper (i.e. `click`, `andThen`, `visit`, etc) has executed,
|
|
53502
|
-
until the returning result is truthy. After the waiters finish, the next async helper
|
|
53503
|
-
is executed and the process repeats.
|
|
53504
|
-
|
|
53505
|
-
For example:
|
|
53506
|
-
|
|
53507
|
-
```javascript
|
|
53508
|
-
import { registerWaiter } from '@ember/test';
|
|
53509
|
-
|
|
53510
|
-
registerWaiter(function() {
|
|
53511
|
-
return myPendingTransactions() === 0;
|
|
53512
|
-
});
|
|
53513
|
-
```
|
|
53514
|
-
The `context` argument allows you to optionally specify the `this`
|
|
53515
|
-
with which your callback will be invoked.
|
|
53516
|
-
|
|
53517
|
-
For example:
|
|
53518
|
-
|
|
53519
|
-
```javascript
|
|
53520
|
-
import { registerWaiter } from '@ember/test';
|
|
53521
|
-
|
|
53522
|
-
registerWaiter(MyDB, MyDB.hasPendingTransactions);
|
|
53523
|
-
```
|
|
53524
|
-
|
|
53525
|
-
@public
|
|
53526
|
-
@for @ember/test
|
|
53527
|
-
@static
|
|
53528
|
-
@method registerWaiter
|
|
53529
|
-
@param {Object} context (optional)
|
|
53530
|
-
@param {Function} callback
|
|
53531
|
-
@since 1.2.0
|
|
53532
|
-
*/
|
|
53533
53467
|
|
|
53534
|
-
function registerWaiter(
|
|
53468
|
+
function registerWaiter() {
|
|
53469
|
+
var checkedCallback;
|
|
53470
|
+
var checkedContext;
|
|
53471
|
+
|
|
53535
53472
|
if (arguments.length === 1) {
|
|
53536
|
-
|
|
53537
|
-
|
|
53473
|
+
checkedContext = null;
|
|
53474
|
+
checkedCallback = arguments.length <= 0 ? undefined : arguments[0];
|
|
53475
|
+
} else {
|
|
53476
|
+
checkedContext = arguments.length <= 0 ? undefined : arguments[0];
|
|
53477
|
+
checkedCallback = arguments.length <= 1 ? undefined : arguments[1];
|
|
53538
53478
|
}
|
|
53539
53479
|
|
|
53540
|
-
if (indexOf(
|
|
53480
|
+
if (indexOf(checkedContext, checkedCallback) > -1) {
|
|
53541
53481
|
return;
|
|
53542
53482
|
}
|
|
53543
53483
|
|
|
53544
|
-
contexts.push(
|
|
53545
|
-
callbacks.push(
|
|
53484
|
+
contexts.push(checkedContext);
|
|
53485
|
+
callbacks.push(checkedCallback);
|
|
53546
53486
|
}
|
|
53547
53487
|
/**
|
|
53548
53488
|
`unregisterWaiter` is used to unregister a callback that was
|
|
@@ -53599,7 +53539,7 @@ define("ember-testing/lib/test/waiters", ["exports"], function (_exports) {
|
|
|
53599
53539
|
|
|
53600
53540
|
for (var i = 0; i < callbacks.length; i++) {
|
|
53601
53541
|
var context = contexts[i];
|
|
53602
|
-
var callback = callbacks[i];
|
|
53542
|
+
var callback = callbacks[i]; // SAFETY: The loop ensures that this exists
|
|
53603
53543
|
|
|
53604
53544
|
if (!callback.call(context)) {
|
|
53605
53545
|
return true;
|
|
@@ -54105,7 +54045,7 @@ define("ember/version", ["exports"], function (_exports) {
|
|
|
54105
54045
|
value: true
|
|
54106
54046
|
});
|
|
54107
54047
|
_exports.default = void 0;
|
|
54108
|
-
var _default = "4.6.0-alpha.
|
|
54048
|
+
var _default = "4.6.0-alpha.3";
|
|
54109
54049
|
_exports.default = _default;
|
|
54110
54050
|
});
|
|
54111
54051
|
define("route-recognizer", ["exports"], function (_exports) {
|