Skip to content

Commit 11202bb

Browse files
committed
use array spread operator to be more concise
1 parent f797511 commit 11202bb

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/immutable-delete.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,5 @@
1212
* // -> resultArray ['a', 'b', 'd', 'e']
1313
*/
1414
export default function immutableDelete(array, index) {
15-
return index >= 0
16-
? array.slice(0, index).concat(array.slice(index + 1))
17-
: array.slice(0);
15+
return index >= 0 ? [...array.slice(0, index), ...array.slice(index + 1)] : [...array];
1816
}

0 commit comments

Comments
 (0)