@@ -59,39 +59,7 @@ import push from 'immutable-arrays/src/immutable-push';
59
59
60
60
## API
61
61
62
- <dl >
63
- <dt ><a href =" #immutableArrays.push " >immutableArrays.push(array, ...elementN)</a > ⇒ <code >Array</code ></dt >
64
- <dd ><p >Adds one or more elements to the end of an array by returning a new array instead of mutating the original one.</p ></dd >
65
-
66
- <dt ><a href =" #immutableArrays.pop " >immutableArrays.pop(array)</a > ⇒ <code >Array</code ></dt >
67
- <dd ><p >Removes the last element from an array by returning a new array instead of mutating the original one.</p ></dd >
68
-
69
- <dt ><a href =" #immutableArrays.shift " >immutableArrays.shift(array)</a > ⇒ <code >Array</code ></dt >
70
- <dd ><p >Removes the first element from an array.</p ></dd >
71
-
72
- <dt ><a href =" #immutableArrays.unshift " >immutableArrays.unshift(array, ...elementN)</a > ⇒ <code >Array</code ></dt >
73
- <dd ><p >Adds one or more elements to the beginning of an array.</p ></dd >
74
-
75
- <dt ><a href =" #immutableArrays.reverse " >immutableArrays.reverse(array)</a > ⇒ <code >Array</code ></dt >
76
- <dd ><p >Reverses an array (not in place). The first array element becomes the last, and the last array element becomes the first.</p ></dd >
77
-
78
- <dt ><a href =" #immutableArrays.sort " >immutableArrays.sort(array, [compareFunction])</a > ⇒ <code >Array</code ></dt >
79
- <dd ><p >Sorts the elements of an array (not in place) and returns a sorted array.</p ></dd >
80
-
81
- <dt ><a href =" #immutableArrays.splice " >immutableArrays.splice(array, [start], [deleteCount], [...elementN])</a > ⇒ <code >Array</code ></dt >
82
- <dd ><p >Removes existing elements and/or adds new elements to an array.</p ></dd >
83
- </dl >
84
-
85
- #### Bonus method
86
-
87
- <dl >
88
- <dt ><a href =" #immutableArrays.del " >immutableArrays.del(array, index)</a > ⇒ <code >Array</code ></dt >
89
- <dd ><p >Deletes an element from an array by its index in the array.</p ></dd >
90
- </dl >
91
-
92
- <a id =" immutableArrays.push " name =" immutableArrays.push " ></a >
93
-
94
- ## immutableArrays.push(array, ...elementN) ⇒ <code >Array</code >
62
+ ### immutableArrays.push(array, ...elementN) ⇒ <code >Array</code >
95
63
Adds one or more elements to the end of an array by returning
96
64
a new array instead of mutating the original one.
97
65
@@ -110,9 +78,7 @@ const resultArray = immutableArrays.push(originalArray, 'f', 'g');
110
78
// -> resultArray ['a', 'b', 'c', 'd', 'e', 'f', 'g']
111
79
```
112
80
113
- <a id =" immutableArrays.pop " name =" immutableArrays.pop " ></a >
114
-
115
- ## immutableArrays.pop(array) ⇒ <code >Array</code >
81
+ ### immutableArrays.pop(array) ⇒ <code >Array</code >
116
82
Removes the last element from an array by returning
117
83
a new array instead of mutating the original one.
118
84
@@ -130,9 +96,7 @@ const resultArray = immutableArrays.pop(originalArray);
130
96
// -> resultArray ['a', 'b', 'c', 'd']
131
97
```
132
98
133
- <a id =" immutableArrays.shift " name =" immutableArrays.shift " ></a >
134
-
135
- ## immutableArrays.shift(array) ⇒ <code >Array</code >
99
+ ### immutableArrays.shift(array) ⇒ <code >Array</code >
136
100
Removes the first element from an array.
137
101
138
102
** Returns** : <code >Array</code > - A new array with the first element removed.
@@ -149,9 +113,7 @@ const resultArray = immutableArrays.shift(originalArray);
149
113
// -> resultArray ['b', 'c', 'd', 'e']
150
114
```
151
115
152
- <a id =" immutableArrays.unshift " name =" immutableArrays.unshift " ></a >
153
-
154
- ## immutableArrays.unshift(array, ...elementN) ⇒ <code >Array</code >
116
+ ### immutableArrays.unshift(array, ...elementN) ⇒ <code >Array</code >
155
117
Adds one or more elements to the beginning of an array.
156
118
157
119
** Returns** : <code >Array</code > - A new array with the new elements added to the front.
@@ -169,9 +131,7 @@ const resultArray = immutableArrays.unshift(originalArray, 'f', 'g');
169
131
// -> resultArray ['f', 'g', 'a', 'b', 'c', 'd', 'e']
170
132
```
171
133
172
- <a id =" immutableArrays.reverse " name =" immutableArrays.reverse " ></a >
173
-
174
- ## immutableArrays.reverse(array) ⇒ <code >Array</code >
134
+ ### immutableArrays.reverse(array) ⇒ <code >Array</code >
175
135
Reverses an array (not in place).
176
136
The first array element becomes the last, and the last array element becomes the first.
177
137
@@ -189,9 +149,7 @@ const resultArray = immutableArrays.reverse(originalArray);
189
149
// -> resultArray ['e', 'd', 'c', 'b', 'a']
190
150
```
191
151
192
- <a id =" immutableArrays.sort " name =" immutableArrays.sort " ></a >
193
-
194
- ## immutableArrays.sort(array, [ compareFunction] ) ⇒ <code >Array</code >
152
+ ### immutableArrays.sort(array, [ compareFunction] ) ⇒ <code >Array</code >
195
153
Sorts the elements of an array (not in place) and returns a sorted array.
196
154
197
155
** Returns** : <code >Array</code > - A new sorted array.
@@ -223,9 +181,7 @@ const resultArray = immutableArrays.sort(stringArray, (a, b) => a.toLowerCase()
223
181
// -> resultArray ['Humpback', 'Blue', 'Beluga']
224
182
```
225
183
226
- <a id =" immutableArrays.splice " name =" immutableArrays.splice " ></a >
227
-
228
- ## immutableArrays.splice(array, [ start] , [ deleteCount] , [ ...elementN] ) ⇒ <code >Array</code >
184
+ ### immutableArrays.splice(array, [ start] , [ deleteCount] , [ ...elementN] ) ⇒ <code >Array</code >
229
185
Removes existing elements and/or adds new elements to an array.
230
186
231
187
** Returns** : <code >Array</code > - The result array.
@@ -285,9 +241,7 @@ const resultArray = immutableArrays.splice(originalArray, originalArray.length -
285
241
// -> resultArray ['a', 'b', 'c', 'lorem', 'ipsum']
286
242
```
287
243
288
- <a id =" immutableArrays.del " name =" immutableArrays.del " ></a >
289
-
290
- ## immutableArrays.del(array, index) ⇒ <code >Array</code >
244
+ ### immutableArrays.del(array, index) ⇒ <code >Array</code >
291
245
Deletes an element from an array by its index in the array.
292
246
293
247
** Returns** : <code >Array</code > - A new array with the element removed.
0 commit comments