Test migration to jest by hand
Apparently using regular expressions is way easier.
This commit is contained in:
10
test/pullAtIndex/pullAtIndex.js
Normal file
10
test/pullAtIndex/pullAtIndex.js
Normal file
@ -0,0 +1,10 @@
|
||||
const pullAtIndex = (arr, pullArr) => {
|
||||
let removed = [];
|
||||
let pulled = arr
|
||||
.map((v, i) => (pullArr.includes(i) ? removed.push(v) : v))
|
||||
.filter((v, i) => !pullArr.includes(i));
|
||||
arr.length = 0;
|
||||
pulled.forEach(v => arr.push(v));
|
||||
return removed;
|
||||
};
|
||||
module.exports = pullAtIndex;
|
||||
Reference in New Issue
Block a user