Spaces:
Paused
Paused
|
Download node_modules/array-rearrange/readme.md from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/array-rearrange/readme.md
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/array-rearrange/readme.md
-
curl -L -o readme.md https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/array-rearrange/readme.md
1.46 kB
array-rearrange
Reorder elements within array by index.
const reorder = require('array-rearrange')
let arr = reorder([9,8,7,6], [3,2,1,0]) // [6,7,8,9]
let arr2 = reorder([3,3, 2,2, 1,1], [2,1,0]) // [1,1, 2,2, 3,3]
API
array = reorder(array, index, stride=1)
Shuffle elements in array according to the index array passed. Permutes original array. index array should contain unique indexes. Pass stride to indicate groups of elements to shuffle.
Originally based on the reference solution, which turns out to be wrong, so algorithm is fully rewritten.
