11let { splice } = Array . prototype ;
22
3- export function _replace ( array , idx , amt , objects ) {
3+ export default function replace ( array , idx , amt , objects ) {
44 let args = [ ] . concat ( objects ) ;
55 let ret = [ ] ;
66 // https://code.google.com/p/chromium/issues/detail?id=56588
@@ -23,38 +23,3 @@ export function _replace(array, idx, amt, objects) {
2323 }
2424 return ret ;
2525}
26-
27- /**
28- Replaces objects in an array with the passed objects.
29-
30- ```javascript
31- let array = [1,2,3];
32- Ember.EnumerableUtils.replace(array, 1, 2, [4, 5]); // [1, 4, 5]
33-
34- let array = [1,2,3];
35- Ember.EnumerableUtils.replace(array, 1, 1, [4, 5]); // [1, 4, 5, 3]
36-
37- let array = [1,2,3];
38- Ember.EnumerableUtils.replace(array, 10, 1, [4, 5]); // [1, 2, 3, 4, 5]
39- ```
40-
41- @method replace
42- @deprecated
43- @param {Array } array The array the objects should be inserted into.
44- @param {Number } idx Starting index in the array to replace. If *idx* >=
45- length, then append to the end of the array.
46- @param {Number } amt Number of elements that should be removed from the array,
47- starting at *idx*
48- @param {Array } objects An array of zero or more objects that should be
49- inserted into the array at *idx*
50-
51- @return {Array } The modified array.
52- @public
53- */
54- export default function replace ( array , idx , amt , objects ) {
55- if ( array . replace ) {
56- return array . replace ( idx , amt , objects ) ;
57- } else {
58- return _replace ( array , idx , amt , objects ) ;
59- }
60- }
0 commit comments