ember-source 4.0.0-beta.9 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -86
- 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 +1 -1
- package/dist/ember-testing.map +1 -1
- package/dist/ember.debug.js +31 -226
- package/dist/ember.debug.map +1 -1
- package/dist/header/license.js +1 -1
- package/dist/packages/@ember/-internals/glimmer/index.js +5 -8
- package/dist/packages/@ember/-internals/metal/index.js +17 -31
- package/dist/packages/@ember/-internals/runtime/lib/mixins/array.js +2 -173
- package/dist/packages/@ember/-internals/runtime/lib/system/array_proxy.js +8 -15
- package/dist/packages/ember/version.js +1 -1
- package/docs/data.json +62 -195
- package/lib/index.js +3 -29
- package/package.json +4 -7
package/docs/data.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"name": "The Ember API",
|
|
4
4
|
"description": "The Ember API: a framework for building ambitious web applications",
|
|
5
5
|
"url": "https://emberjs.com/",
|
|
6
|
-
"version": "4.0.0
|
|
6
|
+
"version": "4.0.0"
|
|
7
7
|
},
|
|
8
8
|
"files": {
|
|
9
9
|
"node_modules/rsvp/lib/rsvp/promise/all.js": {
|
|
@@ -2001,7 +2001,7 @@
|
|
|
2001
2001
|
"namespaces": {},
|
|
2002
2002
|
"tag": "module",
|
|
2003
2003
|
"file": "packages/@ember/-internals/runtime/lib/system/array_proxy.js",
|
|
2004
|
-
"line":
|
|
2004
|
+
"line": 43
|
|
2005
2005
|
},
|
|
2006
2006
|
"@ember/enumerable": {
|
|
2007
2007
|
"name": "@ember/enumerable",
|
|
@@ -3030,7 +3030,7 @@
|
|
|
3030
3030
|
"module": "@ember/array",
|
|
3031
3031
|
"namespace": "",
|
|
3032
3032
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
3033
|
-
"line":
|
|
3033
|
+
"line": 179,
|
|
3034
3034
|
"description": "This mixin implements Observer-friendly Array-like behavior. It is not a\nconcrete implementation, but it can be used up by other classes that want\nto appear like arrays.\n\nFor example, ArrayProxy is a concrete class that can be instantiated to\nimplement array-like behavior. This class uses the Array Mixin by way of\nthe MutableArray mixin, which allows observable changes to be made to the\nunderlying array.\n\nThis mixin defines methods specifically for collections that provide\nindex-ordered access to their contents. When you are designing code that\nneeds to accept any kind of Array-like object, you should use these methods\ninstead of Array primitives because these will properly notify observers of\nchanges to the array.\n\nAlthough these methods are efficient, they do add a layer of indirection to\nyour application so it is a good idea to use them only when you need the\nflexibility of using both true JavaScript arrays and \"virtual\" arrays such\nas controllers and collections.\n\nYou can use the methods defined in this module to access and modify array\ncontents in an observable-friendly way. You can also be notified whenever\nthe membership of an array changes by using `.observes('myArray.[]')`.\n\nTo support `EmberArray` in your own class, you must override two\nprimitives to use it: `length()` and `objectAt()`.",
|
|
3035
3035
|
"uses": [
|
|
3036
3036
|
"Enumerable"
|
|
@@ -3053,7 +3053,7 @@
|
|
|
3053
3053
|
"module": "@ember/array",
|
|
3054
3054
|
"namespace": "",
|
|
3055
3055
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
3056
|
-
"line":
|
|
3056
|
+
"line": 1326,
|
|
3057
3057
|
"description": "This mixin defines the API for modifying array-like objects. These methods\ncan be applied only to a collection that keeps its items in an ordered set.\nIt builds upon the Array mixin and adds methods to modify the array.\nOne concrete implementations of this class include ArrayProxy.\n\nIt is important to use the methods in this class to modify arrays so that\nchanges are observable. This allows the binding system in Ember to function\ncorrectly.\n\n\nNote that an Array can change even if it does not implement this mixin.\nFor example, one might implement a SparseArray that cannot be directly\nmodified, but if its underlying enumerable changes, it will change also.",
|
|
3058
3058
|
"uses": [
|
|
3059
3059
|
"EmberArray",
|
|
@@ -3073,7 +3073,7 @@
|
|
|
3073
3073
|
"module": "ember",
|
|
3074
3074
|
"namespace": "",
|
|
3075
3075
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
3076
|
-
"line":
|
|
3076
|
+
"line": 1747,
|
|
3077
3077
|
"description": "The NativeArray mixin contains the properties needed to make the native\nArray support MutableArray and all of its dependent APIs. Unless you\nhave `EmberENV.EXTEND_PROTOTYPES` or `EmberENV.EXTEND_PROTOTYPES.Array` set to\nfalse, this will be applied automatically. Otherwise you can apply the mixin\nat anytime by calling `Ember.NativeArray.apply(Array.prototype)`.",
|
|
3078
3078
|
"uses": [
|
|
3079
3079
|
"MutableArray",
|
|
@@ -3259,7 +3259,7 @@
|
|
|
3259
3259
|
"module": "@ember/array",
|
|
3260
3260
|
"namespace": "",
|
|
3261
3261
|
"file": "packages/@ember/-internals/runtime/lib/system/array_proxy.js",
|
|
3262
|
-
"line":
|
|
3262
|
+
"line": 43,
|
|
3263
3263
|
"description": "An ArrayProxy wraps any other object that implements `Array` and/or\n`MutableArray,` forwarding all requests. This makes it very useful for\na number of binding use cases or other cases where being able to swap\nout the underlying array is useful.\n\nA simple example of usage:\n\n```javascript\nimport { A } from '@ember/array';\nimport ArrayProxy from '@ember/array/proxy';\n\nlet pets = ['dog', 'cat', 'fish'];\nlet ap = ArrayProxy.create({ content: A(pets) });\n\nap.get('firstObject'); // 'dog'\nap.set('content', ['amoeba', 'paramecium']);\nap.get('firstObject'); // 'amoeba'\n```\n\nThis class can also be useful as a layer to transform the contents of\nan array, as they are accessed. This can be done by overriding\n`objectAtContent`:\n\n```javascript\nimport { A } from '@ember/array';\nimport ArrayProxy from '@ember/array/proxy';\n\nlet pets = ['dog', 'cat', 'fish'];\nlet ap = ArrayProxy.create({\n content: A(pets),\n objectAtContent: function(idx) {\n return this.get('content').objectAt(idx).toUpperCase();\n }\n});\n\nap.get('firstObject'); // . 'DOG'\n```\n\nWhen overriding this class, it is important to place the call to\n`_super` *after* setting `content` so the internal observers have\na chance to fire properly:\n\n```javascript\nimport { A } from '@ember/array';\nimport ArrayProxy from '@ember/array/proxy';\n\nexport default ArrayProxy.extend({\n init() {\n this.set('content', A(['dog', 'cat', 'fish']));\n this._super(...arguments);\n }\n});\n```",
|
|
3264
3264
|
"extends": "EmberObject",
|
|
3265
3265
|
"uses": [
|
|
@@ -10640,7 +10640,7 @@
|
|
|
10640
10640
|
},
|
|
10641
10641
|
{
|
|
10642
10642
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10643
|
-
"line":
|
|
10643
|
+
"line": 105,
|
|
10644
10644
|
"description": "Returns true if the passed object is an array or Array-like.\n\nObjects are considered Array-like if any of the following are true:\n\n - the object is a native Array\n - the object has an objectAt property\n - the object is an Object, and has a length property\n\nUnlike `typeOf` this method returns true even if the passed object is\nnot formally an array but appears to be array-like (i.e. implements `Array`)\n\n```javascript\nimport { isArray } from '@ember/array';\nimport ArrayProxy from '@ember/array/proxy';\n\nisArray(); // false\nisArray([]); // true\nisArray(ArrayProxy.create({ content: [] })); // true\n```",
|
|
10645
10645
|
"itemtype": "method",
|
|
10646
10646
|
"name": "isArray",
|
|
@@ -10663,7 +10663,7 @@
|
|
|
10663
10663
|
},
|
|
10664
10664
|
{
|
|
10665
10665
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10666
|
-
"line":
|
|
10666
|
+
"line": 218,
|
|
10667
10667
|
"description": "__Required.__ You must implement this method to apply this mixin.\n\nYour array must support the `length` property. Your replace methods should\nset this property whenever it changes.",
|
|
10668
10668
|
"itemtype": "property",
|
|
10669
10669
|
"name": "length",
|
|
@@ -10675,7 +10675,7 @@
|
|
|
10675
10675
|
},
|
|
10676
10676
|
{
|
|
10677
10677
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10678
|
-
"line":
|
|
10678
|
+
"line": 228,
|
|
10679
10679
|
"description": "Returns the object at the given `index`. If the given `index` is negative\nor is greater or equal than the array length, returns `undefined`.\n\nThis is one of the primitives you must implement to support `EmberArray`.\nIf your object supports retrieving the value of an array item using `get()`\n(i.e. `myArray.get(0)`), then you do not need to implement this method\nyourself.\n\n```javascript\nlet arr = ['a', 'b', 'c', 'd'];\n\narr.objectAt(0); // 'a'\narr.objectAt(3); // 'd'\narr.objectAt(-1); // undefined\narr.objectAt(4); // undefined\narr.objectAt(5); // undefined\n```",
|
|
10680
10680
|
"itemtype": "method",
|
|
10681
10681
|
"name": "objectAt",
|
|
@@ -10697,7 +10697,7 @@
|
|
|
10697
10697
|
},
|
|
10698
10698
|
{
|
|
10699
10699
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10700
|
-
"line":
|
|
10700
|
+
"line": 253,
|
|
10701
10701
|
"description": "This returns the objects at the specified indexes, using `objectAt`.\n\n```javascript\nlet arr = ['a', 'b', 'c', 'd'];\n\narr.objectsAt([0, 1, 2]); // ['a', 'b', 'c']\narr.objectsAt([2, 3, 4]); // ['c', 'd', undefined]\n```",
|
|
10702
10702
|
"itemtype": "method",
|
|
10703
10703
|
"name": "objectsAt",
|
|
@@ -10719,7 +10719,7 @@
|
|
|
10719
10719
|
},
|
|
10720
10720
|
{
|
|
10721
10721
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10722
|
-
"line":
|
|
10722
|
+
"line": 272,
|
|
10723
10723
|
"description": "This is the handler for the special array content property. If you get\nthis property, it will return this. If you set this property to a new\narray, it will replace the current content.\n\n```javascript\nlet peopleToMoon = ['Armstrong', 'Aldrin'];\n\npeopleToMoon.get('[]'); // ['Armstrong', 'Aldrin']\n\npeopleToMoon.set('[]', ['Collins']); // ['Collins']\npeopleToMoon.get('[]'); // ['Collins']\n```",
|
|
10724
10724
|
"itemtype": "property",
|
|
10725
10725
|
"name": "[]",
|
|
@@ -10733,7 +10733,7 @@
|
|
|
10733
10733
|
},
|
|
10734
10734
|
{
|
|
10735
10735
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10736
|
-
"line":
|
|
10736
|
+
"line": 300,
|
|
10737
10737
|
"description": "The first object in the array, or `undefined` if the array is empty.\n\n```javascript\nlet vowels = ['a', 'e', 'i', 'o', 'u'];\nvowels.firstObject; // 'a'\n\nvowels.shiftObject();\nvowels.firstObject; // 'e'\n\nvowels.reverseObjects();\nvowels.firstObject; // 'u'\n\nvowels.clear();\nvowels.firstObject; // undefined\n```",
|
|
10738
10738
|
"itemtype": "property",
|
|
10739
10739
|
"name": "firstObject",
|
|
@@ -10748,7 +10748,7 @@
|
|
|
10748
10748
|
},
|
|
10749
10749
|
{
|
|
10750
10750
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10751
|
-
"line":
|
|
10751
|
+
"line": 325,
|
|
10752
10752
|
"description": "The last object in the array, or `undefined` if the array is empty.",
|
|
10753
10753
|
"itemtype": "property",
|
|
10754
10754
|
"name": "lastObject",
|
|
@@ -10763,7 +10763,7 @@
|
|
|
10763
10763
|
},
|
|
10764
10764
|
{
|
|
10765
10765
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10766
|
-
"line":
|
|
10766
|
+
"line": 337,
|
|
10767
10767
|
"description": "Returns a new array that is a slice of the receiver. This implementation\nuses the observable array methods to retrieve the objects for the new\nslice.\n\n```javascript\nlet arr = ['red', 'green', 'blue'];\n\narr.slice(0); // ['red', 'green', 'blue']\narr.slice(0, 2); // ['red', 'green']\narr.slice(1, 100); // ['green', 'blue']\n```",
|
|
10768
10768
|
"itemtype": "method",
|
|
10769
10769
|
"name": "slice",
|
|
@@ -10790,7 +10790,7 @@
|
|
|
10790
10790
|
},
|
|
10791
10791
|
{
|
|
10792
10792
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10793
|
-
"line":
|
|
10793
|
+
"line": 377,
|
|
10794
10794
|
"description": "Used to determine the passed object's first occurrence in the array.\nReturns the index if found, -1 if no match is found.\n\nThe optional `startAt` argument can be used to pass a starting\nindex to search from, effectively slicing the searchable portion\nof the array. If it's negative it will add the array length to\nthe startAt value passed in as the index to search from. If less\nthan or equal to `-1 * array.length` the entire array is searched.\n\n```javascript\nlet arr = ['a', 'b', 'c', 'd', 'a'];\n\narr.indexOf('a'); // 0\narr.indexOf('z'); // -1\narr.indexOf('a', 2); // 4\narr.indexOf('a', -1); // 4, equivalent to indexOf('a', 4)\narr.indexOf('a', -100); // 0, searches entire array\narr.indexOf('b', 3); // -1\narr.indexOf('a', 100); // -1\n\nlet people = [{ name: 'Zoey' }, { name: 'Bob' }]\nlet newPerson = { name: 'Tom' };\npeople = [newPerson, ...people, newPerson];\n\npeople.indexOf(newPerson); // 0\npeople.indexOf(newPerson, 1); // 3\npeople.indexOf(newPerson, -4); // 0\npeople.indexOf(newPerson, 10); // -1\n```",
|
|
10795
10795
|
"itemtype": "method",
|
|
10796
10796
|
"name": "indexOf",
|
|
@@ -10817,7 +10817,7 @@
|
|
|
10817
10817
|
},
|
|
10818
10818
|
{
|
|
10819
10819
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10820
|
-
"line":
|
|
10820
|
+
"line": 419,
|
|
10821
10821
|
"description": "Returns the index of the given `object`'s last occurrence.\n\n- If no `startAt` argument is given, the search starts from\nthe last position.\n- If it's greater than or equal to the length of the array,\nthe search starts from the last position.\n- If it's negative, it is taken as the offset from the end\nof the array i.e. `startAt + array.length`.\n- If it's any other positive number, will search backwards\nfrom that index of the array.\n\nReturns -1 if no match is found.\n\n```javascript\nlet arr = ['a', 'b', 'c', 'd', 'a'];\n\narr.lastIndexOf('a'); // 4\narr.lastIndexOf('z'); // -1\narr.lastIndexOf('a', 2); // 0\narr.lastIndexOf('a', -1); // 4\narr.lastIndexOf('a', -3); // 0\narr.lastIndexOf('b', 3); // 1\narr.lastIndexOf('a', 100); // 4\n```",
|
|
10822
10822
|
"itemtype": "method",
|
|
10823
10823
|
"name": "lastIndexOf",
|
|
@@ -10844,140 +10844,7 @@
|
|
|
10844
10844
|
},
|
|
10845
10845
|
{
|
|
10846
10846
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10847
|
-
"line":
|
|
10848
|
-
"description": "Adds an array observer to the receiving array. The array observer object\nnormally must implement two methods:\n\n* `willChange(observedObj, start, removeCount, addCount)` - This method will be\n called just before the array is modified.\n* `didChange(observedObj, start, removeCount, addCount)` - This method will be\n called just after the array is modified.\n\nBoth callbacks will be passed the observed object, starting index of the\nchange as well as a count of the items to be removed and added. You can use\nthese callbacks to optionally inspect the array during the change, clear\ncaches, or do any other bookkeeping necessary.\n\nIn addition to passing a target, you can also include an options hash\nwhich you can use to override the method names that will be invoked on the\ntarget.",
|
|
10849
|
-
"itemtype": "method",
|
|
10850
|
-
"name": "addArrayObserver",
|
|
10851
|
-
"params": [
|
|
10852
|
-
{
|
|
10853
|
-
"name": "target",
|
|
10854
|
-
"description": "The observer object.",
|
|
10855
|
-
"type": "Object"
|
|
10856
|
-
},
|
|
10857
|
-
{
|
|
10858
|
-
"name": "opts",
|
|
10859
|
-
"description": "Optional hash of configuration options including\n `willChange` and `didChange` option.",
|
|
10860
|
-
"type": "Object"
|
|
10861
|
-
}
|
|
10862
|
-
],
|
|
10863
|
-
"return": {
|
|
10864
|
-
"description": "receiver",
|
|
10865
|
-
"type": "EmberArray"
|
|
10866
|
-
},
|
|
10867
|
-
"access": "public",
|
|
10868
|
-
"tagname": "",
|
|
10869
|
-
"example": [
|
|
10870
|
-
"\n import Service from '@ember/service';\n\n export default Service.extend({\n data: Ember.A(),\n\n init() {\n this._super(...arguments);\n\n this.data.addArrayObserver(this, {\n willChange: 'dataWillChange',\n didChange: 'dataDidChange'\n });\n },\n\n dataWillChange(array, start, removeCount, addCount) {\n console.log('array will change', array, start, removeCount, addCount);\n },\n\n dataDidChange(array, start, removeCount, addCount) {\n console.log('array did change', array, start, removeCount, addCount);\n }\n });"
|
|
10871
|
-
],
|
|
10872
|
-
"class": "EmberArray",
|
|
10873
|
-
"module": "@ember/array"
|
|
10874
|
-
},
|
|
10875
|
-
{
|
|
10876
|
-
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10877
|
-
"line": 536,
|
|
10878
|
-
"description": "Removes an array observer from the object if the observer is current\nregistered. Calling this method multiple times with the same object will\nhave no effect.",
|
|
10879
|
-
"itemtype": "method",
|
|
10880
|
-
"name": "removeArrayObserver",
|
|
10881
|
-
"params": [
|
|
10882
|
-
{
|
|
10883
|
-
"name": "target",
|
|
10884
|
-
"description": "The object observing the array.",
|
|
10885
|
-
"type": "Object"
|
|
10886
|
-
},
|
|
10887
|
-
{
|
|
10888
|
-
"name": "opts",
|
|
10889
|
-
"description": "Optional hash of configuration options including\n `willChange` and `didChange` option.",
|
|
10890
|
-
"type": "Object"
|
|
10891
|
-
}
|
|
10892
|
-
],
|
|
10893
|
-
"return": {
|
|
10894
|
-
"description": "receiver",
|
|
10895
|
-
"type": "EmberArray"
|
|
10896
|
-
},
|
|
10897
|
-
"access": "public",
|
|
10898
|
-
"tagname": "",
|
|
10899
|
-
"class": "EmberArray",
|
|
10900
|
-
"module": "@ember/array"
|
|
10901
|
-
},
|
|
10902
|
-
{
|
|
10903
|
-
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10904
|
-
"line": 552,
|
|
10905
|
-
"description": "Becomes true whenever the array currently has observers watching changes\non the array.\n\n```javascript\nlet arr = [1, 2, 3, 4, 5];\narr.hasArrayObservers; // false\n\narr.addArrayObserver(this, {\n willChange() {\n console.log('willChange');\n }\n});\narr.hasArrayObservers; // true\n```",
|
|
10906
|
-
"itemtype": "property",
|
|
10907
|
-
"name": "hasArrayObservers",
|
|
10908
|
-
"type": "Boolean",
|
|
10909
|
-
"access": "public",
|
|
10910
|
-
"tagname": "",
|
|
10911
|
-
"class": "EmberArray",
|
|
10912
|
-
"module": "@ember/array"
|
|
10913
|
-
},
|
|
10914
|
-
{
|
|
10915
|
-
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10916
|
-
"line": 579,
|
|
10917
|
-
"description": "If you are implementing an object that supports `EmberArray`, call this\nmethod just before the array content changes to notify any observers and\ninvalidate any related properties. Pass the starting index of the change\nas well as a delta of the amounts to change.\n\n```app/components/show-post.js\nimport Component from '@ember/component';\nimport EmberObject from '@ember/object';\n\nconst Post = EmberObject.extend({\n body: '',\n save() {}\n})\n\nexport default Component.extend({\n attemptsToModify: 0,\n successfulModifications: 0,\n posts: null,\n\n init() {\n this._super(...arguments);\n\n this.posts = [1, 2, 3].map(i => Post.create({ body: i }));\n this.posts.addArrayObserver(this, {\n willChange() {\n this.incrementProperty('attemptsToModify');\n },\n didChange() {\n this.incrementProperty('successfulModifications');\n }\n });\n },\n\n actions: {\n editPost(post, newContent) {\n let oldContent = post.body,\n postIndex = this.posts.indexOf(post);\n\n this.posts.arrayContentWillChange(postIndex, 0, 0); // attemptsToModify = 1\n post.set('body', newContent);\n\n post.save()\n .then(response => {\n this.posts.arrayContentDidChange(postIndex, 0, 0); // successfulModifications = 1\n })\n .catch(error => {\n post.set('body', oldContent);\n })\n }\n }\n});\n```",
|
|
10918
|
-
"itemtype": "method",
|
|
10919
|
-
"name": "arrayContentWillChange",
|
|
10920
|
-
"params": [
|
|
10921
|
-
{
|
|
10922
|
-
"name": "startIdx",
|
|
10923
|
-
"description": "The starting index in the array that will change.",
|
|
10924
|
-
"type": "Number"
|
|
10925
|
-
},
|
|
10926
|
-
{
|
|
10927
|
-
"name": "removeAmt",
|
|
10928
|
-
"description": "The number of items that will be removed. If you\n pass `null` assumes 0",
|
|
10929
|
-
"type": "Number"
|
|
10930
|
-
},
|
|
10931
|
-
{
|
|
10932
|
-
"name": "addAmt",
|
|
10933
|
-
"description": "The number of items that will be added. If you\n pass `null` assumes 0.",
|
|
10934
|
-
"type": "Number"
|
|
10935
|
-
}
|
|
10936
|
-
],
|
|
10937
|
-
"return": {
|
|
10938
|
-
"description": "receiver",
|
|
10939
|
-
"type": "EmberArray"
|
|
10940
|
-
},
|
|
10941
|
-
"access": "public",
|
|
10942
|
-
"tagname": "",
|
|
10943
|
-
"class": "EmberArray",
|
|
10944
|
-
"module": "@ember/array"
|
|
10945
|
-
},
|
|
10946
|
-
{
|
|
10947
|
-
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10948
|
-
"line": 646,
|
|
10949
|
-
"description": "If you are implementing an object that supports `EmberArray`, call this\nmethod just after the array content changes to notify any observers and\ninvalidate any related properties. Pass the starting index of the change\nas well as a delta of the amounts to change.\n\n```javascript\nlet arr = [1, 2, 3, 4, 5];\n\narr.copyWithin(-2); // [1, 2, 3, 1, 2]\n// arr.lastObject = 5\narr.arrayContentDidChange(3, 2, 2);\n// arr.lastObject = 2\n```",
|
|
10950
|
-
"itemtype": "method",
|
|
10951
|
-
"name": "arrayContentDidChange",
|
|
10952
|
-
"params": [
|
|
10953
|
-
{
|
|
10954
|
-
"name": "startIdx",
|
|
10955
|
-
"description": "The starting index in the array that did change.",
|
|
10956
|
-
"type": "Number"
|
|
10957
|
-
},
|
|
10958
|
-
{
|
|
10959
|
-
"name": "removeAmt",
|
|
10960
|
-
"description": "The number of items that were removed. If you\n pass `null` assumes 0",
|
|
10961
|
-
"type": "Number"
|
|
10962
|
-
},
|
|
10963
|
-
{
|
|
10964
|
-
"name": "addAmt",
|
|
10965
|
-
"description": "The number of items that were added. If you\n pass `null` assumes 0.",
|
|
10966
|
-
"type": "Number"
|
|
10967
|
-
}
|
|
10968
|
-
],
|
|
10969
|
-
"return": {
|
|
10970
|
-
"description": "receiver",
|
|
10971
|
-
"type": "EmberArray"
|
|
10972
|
-
},
|
|
10973
|
-
"access": "public",
|
|
10974
|
-
"tagname": "",
|
|
10975
|
-
"class": "EmberArray",
|
|
10976
|
-
"module": "@ember/array"
|
|
10977
|
-
},
|
|
10978
|
-
{
|
|
10979
|
-
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
10980
|
-
"line": 674,
|
|
10847
|
+
"line": 473,
|
|
10981
10848
|
"description": "Iterates through the array, calling the passed function on each\nitem. This method corresponds to the `forEach()` method defined in\nJavaScript 1.6.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(item, index, array);\n```\n\n- `item` is the current item in the iteration.\n- `index` is the current index in the iteration.\n- `array` is the array itself.\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context. This is a good way\nto give your iterator function access to the current object.\n\nExample Usage:\n\n```javascript\nlet foods = [\n { name: 'apple', eaten: false },\n { name: 'banana', eaten: false },\n { name: 'carrot', eaten: false }\n];\n\nfoods.forEach((food) => food.eaten = true);\n\nlet output = '';\nfoods.forEach((item, index, array) =>\n output += `${index + 1}/${array.length} ${item.name}\\n`;\n);\nconsole.log(output);\n// 1/3 apple\n// 2/3 banana\n// 3/3 carrot\n```",
|
|
10982
10849
|
"itemtype": "method",
|
|
10983
10850
|
"name": "forEach",
|
|
@@ -11005,7 +10872,7 @@
|
|
|
11005
10872
|
},
|
|
11006
10873
|
{
|
|
11007
10874
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11008
|
-
"line":
|
|
10875
|
+
"line": 533,
|
|
11009
10876
|
"description": "Alias for `mapBy`.\n\nReturns the value of the named\nproperty on all items in the enumeration.\n\n```javascript\nlet people = [{name: 'Joe'}, {name: 'Matt'}];\n\npeople.getEach('name');\n// ['Joe', 'Matt'];\n\npeople.getEach('nonexistentProperty');\n// [undefined, undefined];\n```",
|
|
11010
10877
|
"itemtype": "method",
|
|
11011
10878
|
"name": "getEach",
|
|
@@ -11027,7 +10894,7 @@
|
|
|
11027
10894
|
},
|
|
11028
10895
|
{
|
|
11029
10896
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11030
|
-
"line":
|
|
10897
|
+
"line": 556,
|
|
11031
10898
|
"description": "Sets the value on the named property for each member. This is more\nergonomic than using other methods defined on this helper. If the object\nimplements Observable, the value will be changed to `set(),` otherwise\nit will be set directly. `null` objects are skipped.\n\n```javascript\nlet people = [{name: 'Joe'}, {name: 'Matt'}];\n\npeople.setEach('zipCode', '10011');\n// [{name: 'Joe', zipCode: '10011'}, {name: 'Matt', zipCode: '10011'}];\n```",
|
|
11032
10899
|
"itemtype": "method",
|
|
11033
10900
|
"name": "setEach",
|
|
@@ -11054,7 +10921,7 @@
|
|
|
11054
10921
|
},
|
|
11055
10922
|
{
|
|
11056
10923
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11057
|
-
"line":
|
|
10924
|
+
"line": 579,
|
|
11058
10925
|
"description": "Maps all of the items in the enumeration to another value, returning\na new array. This method corresponds to `map()` defined in JavaScript 1.6.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(item, index, array);\nlet arr = [1, 2, 3, 4, 5, 6];\n\narr.map(element => element * element);\n// [1, 4, 9, 16, 25, 36];\n\narr.map((element, index) => element + index);\n// [1, 3, 5, 7, 9, 11];\n```\n\n- `item` is the current item in the iteration.\n- `index` is the current index in the iteration.\n- `array` is the array itself.\n\nIt should return the mapped value.\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context. This is a good way\nto give your iterator function access to the current object.",
|
|
11059
10926
|
"itemtype": "method",
|
|
11060
10927
|
"name": "map",
|
|
@@ -11082,7 +10949,7 @@
|
|
|
11082
10949
|
},
|
|
11083
10950
|
{
|
|
11084
10951
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11085
|
-
"line":
|
|
10952
|
+
"line": 623,
|
|
11086
10953
|
"description": "Similar to map, this specialized function returns the value of the named\nproperty on all items in the enumeration.\n\n```javascript\nlet people = [{name: 'Joe'}, {name: 'Matt'}];\n\npeople.mapBy('name');\n// ['Joe', 'Matt'];\n\npeople.mapBy('unknownProperty');\n// [undefined, undefined];\n```",
|
|
11087
10954
|
"itemtype": "method",
|
|
11088
10955
|
"name": "mapBy",
|
|
@@ -11104,7 +10971,7 @@
|
|
|
11104
10971
|
},
|
|
11105
10972
|
{
|
|
11106
10973
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11107
|
-
"line":
|
|
10974
|
+
"line": 644,
|
|
11108
10975
|
"description": "Returns a new array with all of the items in the enumeration that the provided\ncallback 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).\n\nThe callback method should have the following signature:\n\n```javascript\nfunction(item, index, array);\n```\n\n- `item` is the current item in the iteration.\n- `index` is the current index in the iteration.\n- `array` is the array itself.\n\nAll parameters are optional. The function should return `true` to include the item\nin the results, and `false` otherwise.\n\nExample:\n\n```javascript\nfunction isAdult(person) {\n return person.age > 18;\n};\n\nlet people = Ember.A([{ name: 'John', age: 14 }, { name: 'Joan', age: 45 }]);\n\npeople.filter(isAdult); // returns [{ name: 'Joan', age: 45 }];\n```\n\nNote that in addition to a callback, you can pass an optional target object\nthat will be set as `this` on the context. This is a good way to give your\niterator function access to the current object. For example:\n\n```javascript\nfunction isAdultAndEngineer(person) {\n return person.age > 18 && this.engineering;\n}\n\nclass AdultsCollection {\n engineering = false;\n\n constructor(opts = {}) {\n super(...arguments);\n\n this.engineering = opts.engineering;\n this.people = Ember.A([{ name: 'John', age: 14 }, { name: 'Joan', age: 45 }]);\n }\n}\n\nlet collection = new AdultsCollection({ engineering: true });\ncollection.people.filter(isAdultAndEngineer, { target: collection });\n```",
|
|
11109
10976
|
"itemtype": "method",
|
|
11110
10977
|
"name": "filter",
|
|
@@ -11132,7 +10999,7 @@
|
|
|
11132
10999
|
},
|
|
11133
11000
|
{
|
|
11134
11001
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11135
|
-
"line":
|
|
11002
|
+
"line": 717,
|
|
11136
11003
|
"description": "Returns an array with all of the items in the enumeration where the passed\nfunction returns false. This method is the inverse of filter().\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(item, index, array);\n```\n\n- *item* is the current item in the iteration.\n- *index* is the current index in the iteration\n- *array* is the array itself.\n\nIt should return a falsey value to include the item in the results.\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as \"this\" on the context. This is a good way\nto give your iterator function access to the current object.\n\nExample Usage:\n\n```javascript\nconst food = [\n { food: 'apple', isFruit: true },\n { food: 'bread', isFruit: false },\n { food: 'banana', isFruit: true }\n];\nconst nonFruits = food.reject(function(thing) {\n return thing.isFruit;\n}); // [{food: 'bread', isFruit: false}]\n```",
|
|
11137
11004
|
"itemtype": "method",
|
|
11138
11005
|
"name": "reject",
|
|
@@ -11160,7 +11027,7 @@
|
|
|
11160
11027
|
},
|
|
11161
11028
|
{
|
|
11162
11029
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11163
|
-
"line":
|
|
11030
|
+
"line": 764,
|
|
11164
11031
|
"description": "Filters the array by the property and an optional value. If a value is given, it returns\nthe items that have said value for the property. If not, it returns all the items that\nhave a truthy value for the property.\n\nExample Usage:\n\n```javascript\nlet things = Ember.A([{ food: 'apple', isFruit: true }, { food: 'beans', isFruit: false }]);\n\nthings.filterBy('food', 'beans'); // [{ food: 'beans', isFruit: false }]\nthings.filterBy('isFruit'); // [{ food: 'apple', isFruit: true }]\n```",
|
|
11165
11032
|
"itemtype": "method",
|
|
11166
11033
|
"name": "filterBy",
|
|
@@ -11188,7 +11055,7 @@
|
|
|
11188
11055
|
},
|
|
11189
11056
|
{
|
|
11190
11057
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11191
|
-
"line":
|
|
11058
|
+
"line": 788,
|
|
11192
11059
|
"description": "Returns an array with the items that do not have truthy values for the provided key.\nYou can pass an optional second argument with a target value to reject for the key.\nOtherwise this will reject objects where the provided property evaluates to false.\n\nExample Usage:\n\n```javascript\n let food = [\n { name: \"apple\", isFruit: true },\n { name: \"carrot\", isFruit: false },\n { name: \"bread\", isFruit: false },\n ];\n food.rejectBy('isFruit'); // [{ name: \"carrot\", isFruit: false }, { name: \"bread\", isFruit: false }]\n food.rejectBy('name', 'carrot'); // [{ name: \"apple\", isFruit: true }}, { name: \"bread\", isFruit: false }]\n```",
|
|
11193
11060
|
"itemtype": "method",
|
|
11194
11061
|
"name": "rejectBy",
|
|
@@ -11216,7 +11083,7 @@
|
|
|
11216
11083
|
},
|
|
11217
11084
|
{
|
|
11218
11085
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11219
|
-
"line":
|
|
11086
|
+
"line": 815,
|
|
11220
11087
|
"description": "Returns the first item in the array for which the callback returns true.\nThis method is similar to the `find()` method defined in ECMAScript 2015.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(item, index, array);\n```\n\n- `item` is the current item in the iteration.\n- `index` is the current index in the iteration.\n- `array` is the array itself.\n\nIt should return the `true` to include the item in the results, `false`\notherwise.\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context. This is a good way\nto give your iterator function access to the current object.\n\nExample Usage:\n\n```javascript\nlet users = [\n { id: 1, name: 'Yehuda' },\n { id: 2, name: 'Tom' },\n { id: 3, name: 'Melanie' },\n { id: 4, name: 'Leah' }\n];\n\nusers.find((user) => user.name == 'Tom'); // [{ id: 2, name: 'Tom' }]\nusers.find(({ id }) => id == 3); // [{ id: 3, name: 'Melanie' }]\n```",
|
|
11221
11088
|
"itemtype": "method",
|
|
11222
11089
|
"name": "find",
|
|
@@ -11244,7 +11111,7 @@
|
|
|
11244
11111
|
},
|
|
11245
11112
|
{
|
|
11246
11113
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11247
|
-
"line":
|
|
11114
|
+
"line": 862,
|
|
11248
11115
|
"description": "Returns the first item with a property matching the passed value. You\ncan pass an optional second argument with the target value. Otherwise\nthis will match any property that evaluates to `true`.\n\nThis method works much like the more generic `find()` method.\n\nUsage Example:\n\n```javascript\nlet users = [\n { id: 1, name: 'Yehuda', isTom: false },\n { id: 2, name: 'Tom', isTom: true },\n { id: 3, name: 'Melanie', isTom: false },\n { id: 4, name: 'Leah', isTom: false }\n];\n\nusers.findBy('id', 4); // { id: 4, name: 'Leah', isTom: false }\nusers.findBy('name', 'Melanie'); // { id: 3, name: 'Melanie', isTom: false }\nusers.findBy('isTom'); // { id: 2, name: 'Tom', isTom: true }\n```",
|
|
11249
11116
|
"itemtype": "method",
|
|
11250
11117
|
"name": "findBy",
|
|
@@ -11272,7 +11139,7 @@
|
|
|
11272
11139
|
},
|
|
11273
11140
|
{
|
|
11274
11141
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11275
|
-
"line":
|
|
11142
|
+
"line": 894,
|
|
11276
11143
|
"description": "Returns `true` if the passed function returns true for every item in the\nenumeration. This corresponds with the `Array.prototype.every()` method defined in ES5.\n\nThe callback method should have the following signature:\n\n```javascript\nfunction(item, index, array);\n```\n\n- `item` is the current item in the iteration.\n- `index` is the current index in the iteration.\n- `array` is the array itself.\n\nAll params are optional. The method should return `true` or `false`.\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context. This is a good way\nto give your iterator function access to the current object.\n\nUsage example:\n\n```javascript\nfunction isAdult(person) {\n return person.age > 18;\n};\n\nconst people = Ember.A([{ name: 'John', age: 24 }, { name: 'Joan', age: 45 }]);\nconst areAllAdults = people.every(isAdult);\n```",
|
|
11277
11144
|
"itemtype": "method",
|
|
11278
11145
|
"name": "every",
|
|
@@ -11300,7 +11167,7 @@
|
|
|
11300
11167
|
},
|
|
11301
11168
|
{
|
|
11302
11169
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11303
|
-
"line":
|
|
11170
|
+
"line": 936,
|
|
11304
11171
|
"description": "Returns `true` if the passed property resolves to the value of the second\nargument for all items in the array. This method is often simpler/faster\nthan using a callback.\n\nNote that like the native `Array.every`, `isEvery` will return true when called\non any empty array.\n```javascript\nclass Language {\n constructor(name, isProgrammingLanguage) {\n this.name = name;\n this.programmingLanguage = isProgrammingLanguage;\n }\n}\n\nconst compiledLanguages = [\n new Language('Java', true),\n new Language('Go', true),\n new Language('Rust', true)\n]\n\nconst languagesKnownByMe = [\n new Language('Javascript', true),\n new Language('English', false),\n new Language('Ruby', true)\n]\n\ncompiledLanguages.isEvery('programmingLanguage'); // true\nlanguagesKnownByMe.isEvery('programmingLanguage'); // false\n```",
|
|
11305
11172
|
"itemtype": "method",
|
|
11306
11173
|
"name": "isEvery",
|
|
@@ -11329,7 +11196,7 @@
|
|
|
11329
11196
|
},
|
|
11330
11197
|
{
|
|
11331
11198
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11332
|
-
"line":
|
|
11199
|
+
"line": 978,
|
|
11333
11200
|
"description": "The any() method executes the callback function once for each element\npresent in the array until it finds the one where callback returns a truthy\nvalue (i.e. `true`). If such an element is found, any() immediately returns\ntrue. Otherwise, any() returns false.\n\n```javascript\nfunction(item, index, array);\n```\n\n- `item` is the current item in the iteration.\n- `index` is the current index in the iteration.\n- `array` is the array object itself.\n\nNote that in addition to a callback, you can also pass an optional target\nobject that will be set as `this` on the context. It can be a good way\nto give your iterator function access to an object in cases where an ES6\narrow function would not be appropriate.\n\nUsage Example:\n\n```javascript\nlet includesManager = people.any(this.findPersonInManagersList, this);\n\nlet includesStockHolder = people.any(person => {\n return this.findPersonInStockHoldersList(person)\n});\n\nif (includesManager || includesStockHolder) {\n Paychecks.addBiggerBonus();\n}\n```",
|
|
11334
11201
|
"itemtype": "method",
|
|
11335
11202
|
"name": "any",
|
|
@@ -11357,7 +11224,7 @@
|
|
|
11357
11224
|
},
|
|
11358
11225
|
{
|
|
11359
11226
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11360
|
-
"line":
|
|
11227
|
+
"line": 1022,
|
|
11361
11228
|
"description": "Returns `true` if the passed property resolves to the value of the second\nargument for any item in the array. This method is often simpler/faster\nthan using a callback.\n\nExample usage:\n\n```javascript\nconst food = [\n { food: 'apple', isFruit: true },\n { food: 'bread', isFruit: false },\n { food: 'banana', isFruit: true }\n];\n\nfood.isAny('isFruit'); // true\n```",
|
|
11362
11229
|
"itemtype": "method",
|
|
11363
11230
|
"name": "isAny",
|
|
@@ -11386,7 +11253,7 @@
|
|
|
11386
11253
|
},
|
|
11387
11254
|
{
|
|
11388
11255
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11389
|
-
"line":
|
|
11256
|
+
"line": 1050,
|
|
11390
11257
|
"description": "This will combine the values of the array into a single value. It\nis a useful way to collect a summary value from an array. This\ncorresponds to the `reduce()` method defined in JavaScript 1.8.\n\nThe callback method you provide should have the following signature (all\nparameters are optional):\n\n```javascript\nfunction(previousValue, item, index, array);\n```\n\n- `previousValue` is the value returned by the last call to the iterator.\n- `item` is the current item in the iteration.\n- `index` is the current index in the iteration.\n- `array` is the array itself.\n\nReturn the new cumulative value.\n\nIn addition to the callback you can also pass an `initialValue`. An error\nwill be raised if you do not pass an initial value and the enumerator is\nempty.\n\nNote that unlike the other methods, this method does not allow you to\npass a target object to set as this for the callback. It's part of the\nspec. Sorry.\n\nExample Usage:\n\n```javascript\n let numbers = [1, 2, 3, 4, 5];\n\n numbers.reduce(function(summation, current) {\n return summation + current;\n }); // 15 (1 + 2 + 3 + 4 + 5)\n\n numbers.reduce(function(summation, current) {\n return summation + current;\n }, -15); // 0 (-15 + 1 + 2 + 3 + 4 + 5)\n\n\n let binaryValues = [true, false, false];\n\n binaryValues.reduce(function(truthValue, current) {\n return truthValue && current;\n }); // false (true && false && false)\n```",
|
|
11391
11258
|
"itemtype": "method",
|
|
11392
11259
|
"name": "reduce",
|
|
@@ -11413,7 +11280,7 @@
|
|
|
11413
11280
|
},
|
|
11414
11281
|
{
|
|
11415
11282
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11416
|
-
"line":
|
|
11283
|
+
"line": 1116,
|
|
11417
11284
|
"description": "Invokes the named method on every object in the receiver that\nimplements it. This method corresponds to the implementation in\nPrototype 1.6.\n\n```javascript\nclass Person {\n name = null;\n\n constructor(name) {\n this.name = name;\n }\n\n greet(prefix='Hello') {\n return `${prefix} ${this.name}`;\n }\n}\n\nlet people = [new Person('Joe'), new Person('Matt')];\n\npeople.invoke('greet'); // ['Hello Joe', 'Hello Matt']\npeople.invoke('greet', 'Bonjour'); // ['Bonjour Joe', 'Bonjour Matt']\n```",
|
|
11418
11285
|
"itemtype": "method",
|
|
11419
11286
|
"name": "invoke",
|
|
@@ -11440,7 +11307,7 @@
|
|
|
11440
11307
|
},
|
|
11441
11308
|
{
|
|
11442
11309
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11443
|
-
"line":
|
|
11310
|
+
"line": 1154,
|
|
11444
11311
|
"description": "Simply converts the object into a genuine array. The order is not\nguaranteed. Corresponds to the method implemented by Prototype.",
|
|
11445
11312
|
"itemtype": "method",
|
|
11446
11313
|
"name": "toArray",
|
|
@@ -11455,7 +11322,7 @@
|
|
|
11455
11322
|
},
|
|
11456
11323
|
{
|
|
11457
11324
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11458
|
-
"line":
|
|
11325
|
+
"line": 1166,
|
|
11459
11326
|
"description": "Returns a copy of the array with all `null` and `undefined` elements removed.\n\n```javascript\nlet arr = ['a', null, 'c', undefined];\narr.compact(); // ['a', 'c']\n```",
|
|
11460
11327
|
"itemtype": "method",
|
|
11461
11328
|
"name": "compact",
|
|
@@ -11470,7 +11337,7 @@
|
|
|
11470
11337
|
},
|
|
11471
11338
|
{
|
|
11472
11339
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11473
|
-
"line":
|
|
11340
|
+
"line": 1182,
|
|
11474
11341
|
"description": "Used to determine if the array contains the passed object.\nReturns `true` if found, `false` otherwise.\n\nThe optional `startAt` argument can be used to pass a starting\nindex to search from, effectively slicing the searchable portion\nof the array. If it's negative it will add the array length to\nthe startAt value passed in as the index to search from. If less\nthan or equal to `-1 * array.length` the entire array is searched.\n\nThis method has the same behavior of JavaScript's [Array.includes](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes).\n\n```javascript\n[1, 2, 3].includes(2); // true\n[1, 2, 3].includes(4); // false\n[1, 2, 3].includes(3, 2); // true\n[1, 2, 3].includes(3, 3); // false\n[1, 2, 3].includes(3, -1); // true\n[1, 2, 3].includes(1, -1); // false\n[1, 2, 3].includes(1, -4); // true\n[1, 2, NaN].includes(NaN); // true\n```",
|
|
11475
11342
|
"itemtype": "method",
|
|
11476
11343
|
"name": "includes",
|
|
@@ -11497,7 +11364,7 @@
|
|
|
11497
11364
|
},
|
|
11498
11365
|
{
|
|
11499
11366
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11500
|
-
"line":
|
|
11367
|
+
"line": 1215,
|
|
11501
11368
|
"description": "Sorts the array by the keys specified in the argument.\n\nYou may provide multiple arguments to sort by multiple properties.\n\n```javascript\n let colors = [\n { name: 'red', weight: 500 },\n { name: 'green', weight: 600 },\n { name: 'blue', weight: 500 }\n];\n\n colors.sortBy('name');\n // [{name: 'blue', weight: 500}, {name: 'green', weight: 600}, {name: 'red', weight: 500}]\n\n colors.sortBy('weight', 'name');\n // [{name: 'blue', weight: 500}, {name: 'red', weight: 500}, {name: 'green', weight: 600}]\n ```",
|
|
11502
11369
|
"itemtype": "method",
|
|
11503
11370
|
"name": "sortBy",
|
|
@@ -11520,7 +11387,7 @@
|
|
|
11520
11387
|
},
|
|
11521
11388
|
{
|
|
11522
11389
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11523
|
-
"line":
|
|
11390
|
+
"line": 1259,
|
|
11524
11391
|
"description": "Returns a new array that contains only unique values. The default\nimplementation returns an array regardless of the receiver type.\n\n```javascript\nlet arr = ['a', 'a', 'b', 'b'];\narr.uniq(); // ['a', 'b']\n```\n\nThis only works on primitive data types, e.g. Strings, Numbers, etc.",
|
|
11525
11392
|
"itemtype": "method",
|
|
11526
11393
|
"name": "uniq",
|
|
@@ -11535,7 +11402,7 @@
|
|
|
11535
11402
|
},
|
|
11536
11403
|
{
|
|
11537
11404
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11538
|
-
"line":
|
|
11405
|
+
"line": 1278,
|
|
11539
11406
|
"description": "Returns a new array that contains only items containing a unique property value.\nThe default implementation returns an array regardless of the receiver type.\n\n```javascript\nlet arr = [{ value: 'a' }, { value: 'a' }, { value: 'b' }, { value: 'b' }];\narr.uniqBy('value'); // [{ value: 'a' }, { value: 'b' }]\n\nlet arr = [2.2, 2.1, 3.2, 3.3];\narr.uniqBy(Math.floor); // [2.2, 3.2];\n```",
|
|
11540
11407
|
"itemtype": "method",
|
|
11541
11408
|
"name": "uniqBy",
|
|
@@ -11557,7 +11424,7 @@
|
|
|
11557
11424
|
},
|
|
11558
11425
|
{
|
|
11559
11426
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11560
|
-
"line":
|
|
11427
|
+
"line": 1300,
|
|
11561
11428
|
"description": "Returns a new array that excludes the passed value. The default\nimplementation returns an array regardless of the receiver type.\nIf the receiver does not contain the value it returns the original array.\n\n```javascript\nlet arr = ['a', 'b', 'a', 'c'];\narr.without('a'); // ['b', 'c']\n```",
|
|
11562
11429
|
"itemtype": "method",
|
|
11563
11430
|
"name": "without",
|
|
@@ -11579,8 +11446,8 @@
|
|
|
11579
11446
|
},
|
|
11580
11447
|
{
|
|
11581
11448
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11582
|
-
"line":
|
|
11583
|
-
"description": "__Required.__ You must implement this method to apply this mixin.\n\nThis is one of the primitives you must implement to support `Array`.\nYou should replace amt objects started at idx with the objects in the\npassed array
|
|
11449
|
+
"line": 1348,
|
|
11450
|
+
"description": "__Required.__ You must implement this method to apply this mixin.\n\nThis is one of the primitives you must implement to support `Array`.\nYou should replace amt objects started at idx with the objects in the\npassed array.\n\nNote that this method is expected to validate the type(s) of objects that it expects.",
|
|
11584
11451
|
"itemtype": "method",
|
|
11585
11452
|
"name": "replace",
|
|
11586
11453
|
"params": [
|
|
@@ -11607,7 +11474,7 @@
|
|
|
11607
11474
|
},
|
|
11608
11475
|
{
|
|
11609
11476
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11610
|
-
"line":
|
|
11477
|
+
"line": 1367,
|
|
11611
11478
|
"description": "Remove all elements from the array. This is useful if you\nwant to reuse an existing array without having to recreate it.\n\n```javascript\nlet colors = ['red', 'green', 'blue'];\n\ncolors.length; // 3\ncolors.clear(); // []\ncolors.length; // 0\n```",
|
|
11612
11479
|
"itemtype": "method",
|
|
11613
11480
|
"name": "clear",
|
|
@@ -11622,7 +11489,7 @@
|
|
|
11622
11489
|
},
|
|
11623
11490
|
{
|
|
11624
11491
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11625
|
-
"line":
|
|
11492
|
+
"line": 1393,
|
|
11626
11493
|
"description": "This will use the primitive `replace()` method to insert an object at the\nspecified index.\n\n```javascript\nlet colors = ['red', 'green', 'blue'];\n\ncolors.insertAt(2, 'yellow'); // ['red', 'green', 'yellow', 'blue']\ncolors.insertAt(5, 'orange'); // Error: Index out of range\n```",
|
|
11627
11494
|
"itemtype": "method",
|
|
11628
11495
|
"name": "insertAt",
|
|
@@ -11649,7 +11516,7 @@
|
|
|
11649
11516
|
},
|
|
11650
11517
|
{
|
|
11651
11518
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11652
|
-
"line":
|
|
11519
|
+
"line": 1415,
|
|
11653
11520
|
"description": "Remove an object at the specified index using the `replace()` primitive\nmethod. You can pass either a single index, or a start and a length.\n\nIf you pass a start and length that is beyond the\nlength this method will throw an assertion.\n\n```javascript\nlet colors = ['red', 'green', 'blue', 'yellow', 'orange'];\n\ncolors.removeAt(0); // ['green', 'blue', 'yellow', 'orange']\ncolors.removeAt(2, 2); // ['green', 'blue']\ncolors.removeAt(4, 2); // Error: Index out of range\n```",
|
|
11654
11521
|
"itemtype": "method",
|
|
11655
11522
|
"name": "removeAt",
|
|
@@ -11676,7 +11543,7 @@
|
|
|
11676
11543
|
},
|
|
11677
11544
|
{
|
|
11678
11545
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11679
|
-
"line":
|
|
11546
|
+
"line": 1440,
|
|
11680
11547
|
"description": "Push the object onto the end of the array. Works just like `push()` but it\nis KVO-compliant.\n\n```javascript\nlet colors = ['red', 'green'];\n\ncolors.pushObject('black'); // ['red', 'green', 'black']\ncolors.pushObject(['yellow']); // ['red', 'green', ['yellow']]\n```",
|
|
11681
11548
|
"itemtype": "method",
|
|
11682
11549
|
"name": "pushObject",
|
|
@@ -11697,7 +11564,7 @@
|
|
|
11697
11564
|
},
|
|
11698
11565
|
{
|
|
11699
11566
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11700
|
-
"line":
|
|
11567
|
+
"line": 1460,
|
|
11701
11568
|
"description": "Add the objects in the passed array to the end of the array. Defers\nnotifying observers of the change until all objects are added.\n\n```javascript\nlet colors = ['red'];\n\ncolors.pushObjects(['yellow', 'orange']); // ['red', 'yellow', 'orange']\n```",
|
|
11702
11569
|
"itemtype": "method",
|
|
11703
11570
|
"name": "pushObjects",
|
|
@@ -11719,7 +11586,7 @@
|
|
|
11719
11586
|
},
|
|
11720
11587
|
{
|
|
11721
11588
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11722
|
-
"line":
|
|
11589
|
+
"line": 1480,
|
|
11723
11590
|
"description": "Pop object from array or nil if none are left. Works just like `pop()` but\nit is KVO-compliant.\n\n```javascript\nlet colors = ['red', 'green', 'blue'];\n\ncolors.popObject(); // 'blue'\nconsole.log(colors); // ['red', 'green']\n```",
|
|
11724
11591
|
"itemtype": "method",
|
|
11725
11592
|
"name": "popObject",
|
|
@@ -11733,7 +11600,7 @@
|
|
|
11733
11600
|
},
|
|
11734
11601
|
{
|
|
11735
11602
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11736
|
-
"line":
|
|
11603
|
+
"line": 1506,
|
|
11737
11604
|
"description": "Shift an object from start of array or nil if none are left. Works just\nlike `shift()` but it is KVO-compliant.\n\n```javascript\nlet colors = ['red', 'green', 'blue'];\n\ncolors.shiftObject(); // 'red'\nconsole.log(colors); // ['green', 'blue']\n```",
|
|
11738
11605
|
"itemtype": "method",
|
|
11739
11606
|
"name": "shiftObject",
|
|
@@ -11747,7 +11614,7 @@
|
|
|
11747
11614
|
},
|
|
11748
11615
|
{
|
|
11749
11616
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11750
|
-
"line":
|
|
11617
|
+
"line": 1531,
|
|
11751
11618
|
"description": "Unshift an object to start of array. Works just like `unshift()` but it is\nKVO-compliant.\n\n```javascript\nlet colors = ['red'];\n\ncolors.unshiftObject('yellow'); // ['yellow', 'red']\ncolors.unshiftObject(['black']); // [['black'], 'yellow', 'red']\n```",
|
|
11752
11619
|
"itemtype": "method",
|
|
11753
11620
|
"name": "unshiftObject",
|
|
@@ -11768,7 +11635,7 @@
|
|
|
11768
11635
|
},
|
|
11769
11636
|
{
|
|
11770
11637
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11771
|
-
"line":
|
|
11638
|
+
"line": 1551,
|
|
11772
11639
|
"description": "Adds the named objects to the beginning of the array. Defers notifying\nobservers until all objects have been added.\n\n```javascript\nlet colors = ['red'];\n\ncolors.unshiftObjects(['black', 'white']); // ['black', 'white', 'red']\ncolors.unshiftObjects('yellow'); // Type Error: 'undefined' is not a function\n```",
|
|
11773
11640
|
"itemtype": "method",
|
|
11774
11641
|
"name": "unshiftObjects",
|
|
@@ -11790,7 +11657,7 @@
|
|
|
11790
11657
|
},
|
|
11791
11658
|
{
|
|
11792
11659
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11793
|
-
"line":
|
|
11660
|
+
"line": 1572,
|
|
11794
11661
|
"description": "Reverse objects in the array. Works just like `reverse()` but it is\nKVO-compliant.",
|
|
11795
11662
|
"itemtype": "method",
|
|
11796
11663
|
"name": "reverseObjects",
|
|
@@ -11805,7 +11672,7 @@
|
|
|
11805
11672
|
},
|
|
11806
11673
|
{
|
|
11807
11674
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11808
|
-
"line":
|
|
11675
|
+
"line": 1591,
|
|
11809
11676
|
"description": "Replace all the receiver's content with content of the argument.\nIf argument is an empty array receiver will be cleared.\n\n```javascript\nlet colors = ['red', 'green', 'blue'];\n\ncolors.setObjects(['black', 'white']); // ['black', 'white']\ncolors.setObjects([]); // []\n```",
|
|
11810
11677
|
"itemtype": "method",
|
|
11811
11678
|
"name": "setObjects",
|
|
@@ -11827,7 +11694,7 @@
|
|
|
11827
11694
|
},
|
|
11828
11695
|
{
|
|
11829
11696
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11830
|
-
"line":
|
|
11697
|
+
"line": 1618,
|
|
11831
11698
|
"description": "Remove all occurrences of an object in the array.\n\n```javascript\nlet cities = ['Chicago', 'Berlin', 'Lima', 'Chicago'];\n\ncities.removeObject('Chicago'); // ['Berlin', 'Lima']\ncities.removeObject('Lima'); // ['Berlin']\ncities.removeObject('Tokyo') // ['Berlin']\n```",
|
|
11832
11699
|
"itemtype": "method",
|
|
11833
11700
|
"name": "removeObject",
|
|
@@ -11849,7 +11716,7 @@
|
|
|
11849
11716
|
},
|
|
11850
11717
|
{
|
|
11851
11718
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11852
|
-
"line":
|
|
11719
|
+
"line": 1646,
|
|
11853
11720
|
"description": "Removes each object in the passed array from the receiver.",
|
|
11854
11721
|
"itemtype": "method",
|
|
11855
11722
|
"name": "removeObjects",
|
|
@@ -11871,7 +11738,7 @@
|
|
|
11871
11738
|
},
|
|
11872
11739
|
{
|
|
11873
11740
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11874
|
-
"line":
|
|
11741
|
+
"line": 1663,
|
|
11875
11742
|
"description": "Push the object onto the end of the array if it is not already\npresent in the array.\n\n```javascript\nlet cities = ['Chicago', 'Berlin'];\n\ncities.addObject('Lima'); // ['Chicago', 'Berlin', 'Lima']\ncities.addObject('Berlin'); // ['Chicago', 'Berlin', 'Lima']\n```",
|
|
11876
11743
|
"itemtype": "method",
|
|
11877
11744
|
"name": "addObject",
|
|
@@ -11893,7 +11760,7 @@
|
|
|
11893
11760
|
},
|
|
11894
11761
|
{
|
|
11895
11762
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11896
|
-
"line":
|
|
11763
|
+
"line": 1689,
|
|
11897
11764
|
"description": "Adds each object in the passed array to the receiver.",
|
|
11898
11765
|
"itemtype": "method",
|
|
11899
11766
|
"name": "addObjects",
|
|
@@ -11915,7 +11782,7 @@
|
|
|
11915
11782
|
},
|
|
11916
11783
|
{
|
|
11917
11784
|
"file": "packages/@ember/-internals/runtime/lib/mixins/array.js",
|
|
11918
|
-
"line":
|
|
11785
|
+
"line": 1705,
|
|
11919
11786
|
"description": "Creates an `Ember.NativeArray` from an Array-like object.\nDoes not modify the original object's contents. `A()` is not needed if\n`EmberENV.EXTEND_PROTOTYPES` is `true` (the default value). However,\nit is recommended that you use `A()` when creating addons for\nember or when you can not guarantee that `EmberENV.EXTEND_PROTOTYPES`\nwill be `true`.\n\nExample\n\n```app/components/my-component.js\nimport Component from '@ember/component';\nimport { A } from '@ember/array';\n\nexport default Component.extend({\n tagName: 'ul',\n classNames: ['pagination'],\n\n init() {\n this._super(...arguments);\n\n if (!this.get('content')) {\n this.set('content', A());\n this.set('otherContent', A([1,2,3]));\n }\n }\n});\n```",
|
|
11920
11787
|
"itemtype": "method",
|
|
11921
11788
|
"name": "A",
|
|
@@ -12917,7 +12784,7 @@
|
|
|
12917
12784
|
},
|
|
12918
12785
|
{
|
|
12919
12786
|
"file": "packages/@ember/-internals/runtime/lib/system/array_proxy.js",
|
|
12920
|
-
"line":
|
|
12787
|
+
"line": 141,
|
|
12921
12788
|
"description": "The content array. Must be an object that implements `Array` and/or\n`MutableArray.`",
|
|
12922
12789
|
"itemtype": "property",
|
|
12923
12790
|
"name": "content",
|
|
@@ -12929,7 +12796,7 @@
|
|
|
12929
12796
|
},
|
|
12930
12797
|
{
|
|
12931
12798
|
"file": "packages/@ember/-internals/runtime/lib/system/array_proxy.js",
|
|
12932
|
-
"line":
|
|
12799
|
+
"line": 150,
|
|
12933
12800
|
"description": "Should actually retrieve the object at the specified index from the\ncontent. You can override this method in subclasses to transform the\ncontent item to something new.\n\nThis method will only be called if content is non-`null`.",
|
|
12934
12801
|
"itemtype": "method",
|
|
12935
12802
|
"name": "objectAtContent",
|
|
@@ -12951,7 +12818,7 @@
|
|
|
12951
12818
|
},
|
|
12952
12819
|
{
|
|
12953
12820
|
"file": "packages/@ember/-internals/runtime/lib/system/array_proxy.js",
|
|
12954
|
-
"line":
|
|
12821
|
+
"line": 176,
|
|
12955
12822
|
"description": "Should actually replace the specified objects on the content array.\nYou can override this method in subclasses to transform the content item\ninto something new.\n\nThis method will only be called if content is non-`null`.",
|
|
12956
12823
|
"itemtype": "method",
|
|
12957
12824
|
"name": "replaceContent",
|
|
@@ -12983,7 +12850,7 @@
|
|
|
12983
12850
|
},
|
|
12984
12851
|
{
|
|
12985
12852
|
"file": "packages/@ember/-internals/runtime/lib/system/array_proxy.js",
|
|
12986
|
-
"line":
|
|
12853
|
+
"line": 346,
|
|
12987
12854
|
"description": "The array that the proxy pretends to be. In the default `ArrayProxy`\nimplementation, this and `content` are the same. Subclasses of `ArrayProxy`\ncan override this property to provide things like sorting and filtering.",
|
|
12988
12855
|
"itemtype": "property",
|
|
12989
12856
|
"name": "arrangedContent",
|