ember-source 4.0.0-beta.3 → 4.0.0-beta.7

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.
@@ -69,23 +69,6 @@ function multiArrayMacro(_dependentKeys, callback, name) {
69
69
  invoice.total; // 13.49
70
70
  ```
71
71
 
72
- Classic Class Example:
73
-
74
- ```javascript
75
- import EmberObject from '@ember/object';
76
- import { sum } from '@ember/object/computed';
77
-
78
- let Invoice = EmberObject.extend({
79
- lineItems: [1.00, 2.50, 9.99],
80
-
81
- total: sum('lineItems')
82
- })
83
-
84
- let invoice = Invoice.create();
85
-
86
- invoice.total; // 13.49
87
- ```
88
-
89
72
  @method sum
90
73
  @for @ember/object/computed
91
74
  @static
@@ -143,42 +126,6 @@ export function sum(dependentKey) {
143
126
  lordByron.maxChildAge; // 8
144
127
  ```
145
128
 
146
- Classic Class Example:
147
-
148
- ```javascript
149
- import EmberObject, { set } from '@ember/object';
150
- import { mapBy, max } from '@ember/object/computed';
151
-
152
- let Person = EmberObject.extend({
153
- childAges: mapBy('children', 'age'),
154
- maxChildAge: max('childAges')
155
- });
156
-
157
- let lordByron = Person.create({ children: [] });
158
-
159
- lordByron.maxChildAge; // -Infinity
160
-
161
- set(lordByron, 'children', [
162
- {
163
- name: 'Augusta Ada Byron',
164
- age: 7
165
- }
166
- ]);
167
- lordByron.maxChildAge; // 7
168
-
169
- set(lordByron, 'children', [
170
- ...lordByron.children,
171
- {
172
- name: 'Allegra Byron',
173
- age: 5
174
- }, {
175
- name: 'Elizabeth Medora Leigh',
176
- age: 8
177
- }
178
- ]);
179
- lordByron.maxChildAge; // 8
180
- ```
181
-
182
129
  If the types of the arguments are not numbers, they will be converted to
183
130
  numbers and the type of the return value will always be `Number`. For example,
184
131
  the max of a list of Date objects will be the highest timestamp as a `Number`.
@@ -239,42 +186,6 @@ export function max(dependentKey) {
239
186
  lordByron.minChildAge; // 5
240
187
  ```
241
188
 
242
- Classic Class Example:
243
-
244
- ```javascript
245
- import EmberObject, { set } from '@ember/object';
246
- import { mapBy, min } from '@ember/object/computed';
247
-
248
- let Person = EmberObject.extend({
249
- childAges: mapBy('children', 'age'),
250
- minChildAge: min('childAges')
251
- });
252
-
253
- let lordByron = Person.create({ children: [] });
254
-
255
- lordByron.minChildAge; // Infinity
256
-
257
- set(lordByron, 'children', [
258
- {
259
- name: 'Augusta Ada Byron',
260
- age: 7
261
- }
262
- ]);
263
- lordByron.minChildAge; // 7
264
-
265
- set(lordByron, 'children', [
266
- ...lordByron.children,
267
- {
268
- name: 'Allegra Byron',
269
- age: 5
270
- }, {
271
- name: 'Elizabeth Medora Leigh',
272
- age: 8
273
- }
274
- ]);
275
- lordByron.minChildAge; // 5
276
- ```
277
-
278
189
  If the types of the arguments are not numbers, they will be converted to
279
190
  numbers and the type of the return value will always be `Number`. For example,
280
191
  the min of a list of Date objects will be the lowest timestamp as a `Number`.
@@ -325,25 +236,6 @@ export function min(dependentKey) {
325
236
  hamster.excitingChores; // ['CLEAN!', 'WRITE MORE UNIT TESTS!']
326
237
  ```
327
238
 
328
- Classic Class Example:
329
-
330
- ```javascript
331
- import EmberObject from '@ember/object';
332
- import { map } from '@ember/object/computed';
333
-
334
- let Hamster = EmberObject.extend({
335
- excitingChores: map('chores', function(chore, index) {
336
- return `${chore.toUpperCase()}!`;
337
- })
338
- });
339
-
340
- let hamster = Hamster.create({
341
- chores: ['clean', 'write more unit tests']
342
- });
343
-
344
- hamster.excitingChores; // ['CLEAN!', 'WRITE MORE UNIT TESTS!']
345
- ```
346
-
347
239
  You can optionally pass an array of additional dependent keys as the second
348
240
  parameter to the macro, if your map function relies on any external values:
349
241
 
@@ -441,41 +333,6 @@ export function map(dependentKey, additionalDependentKeys, callback) {
441
333
  lordByron.childAges; // [7, 5, 8]
442
334
  ```
443
335
 
444
- Classic Class Example:
445
-
446
- ```javascript
447
- import EmberObject, { set } from '@ember/object';
448
- import { mapBy } from '@ember/object/computed';
449
-
450
- let Person = EmberObject.extend({
451
- childAges: mapBy('children', 'age')
452
- });
453
-
454
- let lordByron = Person.create({ children: [] });
455
-
456
- lordByron.childAges; // []
457
-
458
- set(lordByron, 'children', [
459
- {
460
- name: 'Augusta Ada Byron',
461
- age: 7
462
- }
463
- ]);
464
- lordByron.childAges; // [7]
465
-
466
- set(lordByron, 'children', [
467
- ...lordByron.children,
468
- {
469
- name: 'Allegra Byron',
470
- age: 5
471
- }, {
472
- name: 'Elizabeth Medora Leigh',
473
- age: 8
474
- }
475
- ]);
476
- lordByron.childAges; // [7, 5, 8]
477
- ```
478
-
479
336
  @method mapBy
480
337
  @for @ember/object/computed
481
338
  @static
@@ -529,29 +386,6 @@ export function mapBy(dependentKey, propertyKey) {
529
386
  hamster.remainingChores; // [{name: 'write more unit tests', done: false}]
530
387
  ```
531
388
 
532
- Classic Class Example:
533
-
534
- ```javascript
535
- import EmberObject from '@ember/object';
536
- import { filter } from '@ember/object/computed';
537
-
538
- let Hamster = EmberObject.extend({
539
- remainingChores: filter('chores', function(chore, index, array) {
540
- return !chore.done;
541
- })
542
- });
543
-
544
- let hamster = Hamster.create({
545
- chores: [
546
- { name: 'cook', done: true },
547
- { name: 'clean', done: true },
548
- { name: 'write more unit tests', done: false }
549
- ]
550
- });
551
-
552
- hamster.remainingChores; // [{name: 'write more unit tests', done: false}]
553
- ```
554
-
555
389
  You can also use `@each.property` in your dependent key, the callback will
556
390
  still use the underlying array:
557
391
 
@@ -660,27 +494,6 @@ export function filter(dependentKey, additionalDependentKeys, callback) {
660
494
  hamster.remainingChores; // [{ name: 'write more unit tests', done: false }]
661
495
  ```
662
496
 
663
- Classic Class Example:
664
-
665
- ```javascript
666
- import EmberObject from '@ember/object';
667
- import { filterBy } from '@ember/object/computed';
668
-
669
- let Hamster = EmberObject.extend({
670
- remainingChores: filterBy('chores', 'done', false)
671
- });
672
-
673
- let hamster = Hamster.create({
674
- chores: [
675
- { name: 'cook', done: true },
676
- { name: 'clean', done: true },
677
- { name: 'write more unit tests', done: false }
678
- ]
679
- });
680
-
681
- hamster.remainingChores; // [{ name: 'write more unit tests', done: false }]
682
- ```
683
-
684
497
  @method filterBy
685
498
  @for @ember/object/computed
686
499
  @static
@@ -732,28 +545,6 @@ export function filterBy(dependentKey, propertyKey, value) {
732
545
  hamster.uniqueFruits; // ['banana', 'grape', 'kale']
733
546
  ```
734
547
 
735
- Classic Class Example:
736
-
737
- ```javascript
738
- import EmberObject from '@ember/object';
739
- import { uniq } from '@ember/object/computed';
740
-
741
- let Hamster = EmberObject.extend({
742
- uniqueFruits: uniq('fruits')
743
- });
744
-
745
- let hamster = Hamster.create({
746
- fruits: [
747
- 'banana',
748
- 'grape',
749
- 'kale',
750
- 'banana'
751
- ]
752
- });
753
-
754
- hamster.uniqueFruits; // ['banana', 'grape', 'kale']
755
- ```
756
-
757
548
  @method uniq
758
549
  @for @ember/object/computed
759
550
  @static
@@ -811,28 +602,6 @@ export function uniq(...args) {
811
602
  hamster.uniqueFruits; // [ { id: 1, 'banana' }, { id: 2, 'grape' }, { id: 3, 'peach' }]
812
603
  ```
813
604
 
814
- Classic Class Example:
815
-
816
- ```javascript
817
- import EmberObject from '@ember/object';
818
- import { uniqBy } from '@ember/object/computed';
819
-
820
- let Hamster = EmberObject.extend({
821
- uniqueFruits: uniqBy('fruits', 'id')
822
- });
823
-
824
- let hamster = Hamster.create({
825
- fruits: [
826
- { id: 1, 'banana' },
827
- { id: 2, 'grape' },
828
- { id: 3, 'peach' },
829
- { id: 1, 'banana' }
830
- ]
831
- });
832
-
833
- hamster.uniqueFruits; // [ { id: 1, 'banana' }, { id: 2, 'grape' }, { id: 3, 'peach' }]
834
- ```
835
-
836
605
  @method uniqBy
837
606
  @for @ember/object/computed
838
607
  @static
@@ -888,34 +657,6 @@ export function uniqBy(dependentKey, propertyKey) {
888
657
  hamster.uniqueFruits; // ['banana', 'grape', 'kale', 'tomato', 'carrot', 'lettuce']
889
658
  ```
890
659
 
891
- Classic Class Example:
892
-
893
- ```javascript
894
- import EmberObject from '@ember/object';
895
- import { union } from '@ember/object/computed';
896
-
897
- let Hamster = EmberObject.extend({
898
- uniqueFruits: union('fruits', 'vegetables')
899
- });
900
-
901
- let hamster = Hamster.create({
902
- fruits: [
903
- 'banana',
904
- 'grape',
905
- 'kale',
906
- 'banana',
907
- 'tomato'
908
- ],
909
- vegetables: [
910
- 'tomato',
911
- 'carrot',
912
- 'lettuce'
913
- ]
914
- });
915
-
916
- hamster.uniqueFruits; // ['banana', 'grape', 'kale', 'tomato', 'carrot', 'lettuce']
917
- ```
918
-
919
660
  @method union
920
661
  @for @ember/object/computed
921
662
  @static
@@ -953,24 +694,6 @@ export let union = uniq;
953
694
  groups.friendsInCommon; // ['William King', 'Mary Somerville']
954
695
  ```
955
696
 
956
- Classic Class Example:
957
-
958
- ```javascript
959
- import EmberObject from '@ember/object';
960
- import { intersect } from '@ember/object/computed';
961
-
962
- let FriendGroups = EmberObject.extend({
963
- friendsInCommon: intersect('adaFriends', 'charlesFriends')
964
- });
965
-
966
- let groups = FriendGroups.create({
967
- adaFriends: ['Charles Babbage', 'John Hobhouse', 'William King', 'Mary Somerville'],
968
- charlesFriends: ['William King', 'Mary Somerville', 'Ada Lovelace', 'George Peacock']
969
- });
970
-
971
- groups.friendsInCommon; // ['William King', 'Mary Somerville']
972
- ```
973
-
974
697
  @method intersect
975
698
  @for @ember/object/computed
976
699
  @static
@@ -1043,31 +766,6 @@ export function intersect(...args) {
1043
766
  hamster.wants; // ['banana']
1044
767
  ```
1045
768
 
1046
- Classic Class Example:
1047
-
1048
- ```javascript
1049
- import EmberObject from '@ember/object';
1050
- import { setDiff } from '@ember/object/computed';
1051
-
1052
- let Hamster = EmberObject.extend({
1053
- wants: setDiff('likes', 'fruits')
1054
- });
1055
-
1056
- let hamster = Hamster.create({
1057
- likes: [
1058
- 'banana',
1059
- 'grape',
1060
- 'kale'
1061
- ],
1062
- fruits: [
1063
- 'grape',
1064
- 'kale',
1065
- ]
1066
- });
1067
-
1068
- hamster.wants; // ['banana']
1069
- ```
1070
-
1071
769
  @method setDiff
1072
770
  @for @ember/object/computed
1073
771
  @static
@@ -1120,25 +818,6 @@ export function setDiff(setAProperty, setBProperty) {
1120
818
  hamster.clothes; // ['Camp Hat', 'Camp Shirt']
1121
819
  ```
1122
820
 
1123
- Classic Class Example:
1124
-
1125
- ```javascript
1126
- import EmberObject, { set } from '@ember/object';
1127
- import { collect } from '@ember/object/computed';
1128
-
1129
- let Hamster = EmberObject.extend({
1130
- clothes: collect('hat', 'shirt')
1131
- });
1132
-
1133
- let hamster = Hamster.create();
1134
-
1135
- hamster.clothes; // [null, null]
1136
-
1137
- set(hamster, 'hat', 'Camp Hat');
1138
- set(hamster, 'shirt', 'Camp Shirt');
1139
- hamster.clothes; // ['Camp Hat', 'Camp Shirt']
1140
- ```
1141
-
1142
821
  @method collect
1143
822
  @for @ember/object/computed
1144
823
  @static
@@ -1218,36 +897,6 @@ export function collect(...dependentKeys) {
1218
897
  todoList.priorityTodos; // [{ name:'Release', priority:1 }, { name:'Unit Test', priority:2 }, { name:'Documentation', priority:3 }]
1219
898
  ```
1220
899
 
1221
- Classic Class Example:
1222
-
1223
- ```javascript
1224
- import EmberObject from '@ember/object';
1225
- import { sort } from '@ember/object/computed';
1226
-
1227
- let ToDoList = EmberObject.extend({
1228
- // using a custom sort function
1229
- priorityTodos: sort('todos', function(a, b){
1230
- if (a.priority > b.priority) {
1231
- return 1;
1232
- } else if (a.priority < b.priority) {
1233
- return -1;
1234
- }
1235
-
1236
- return 0;
1237
- })
1238
- });
1239
-
1240
- let todoList = ToDoList.create({
1241
- todos: [
1242
- { name: 'Unit Test', priority: 2 },
1243
- { name: 'Documentation', priority: 3 },
1244
- { name: 'Release', priority: 1 }
1245
- ]
1246
- });
1247
-
1248
- todoList.priorityTodos; // [{ name:'Release', priority:1 }, { name:'Unit Test', priority:2 }, { name:'Documentation', priority:3 }]
1249
- ```
1250
-
1251
900
  You can also optionally pass an array of additional dependent keys as the
1252
901
  second parameter, if your sort function is dependent on additional values that
1253
902
  could changes:
@@ -1 +1 @@
1
- export default "4.0.0-beta.3";
1
+ export default "4.0.0-beta.7";