diff options
| author | ruki <waruqi@gmail.com> | 2018-11-08 00:38:48 +0800 |
|---|---|---|
| committer | ruki <waruqi@gmail.com> | 2018-11-07 21:53:09 +0800 |
| commit | 26105034da4fcce7ac883c899d781f016559310d (patch) | |
| tree | c459a5dc4e3aa0972d9919033ece511ce76dd129 /node_modules/remove-array-items/README.md | |
| parent | 2c77f00f1a7ecb6c8192f9c16d3b2001b254a107 (diff) | |
| download | xmake-docs-26105034da4fcce7ac883c899d781f016559310d.tar.gz xmake-docs-26105034da4fcce7ac883c899d781f016559310d.zip | |
switch to vuepress
Diffstat (limited to 'node_modules/remove-array-items/README.md')
| -rw-r--r-- | node_modules/remove-array-items/README.md | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/node_modules/remove-array-items/README.md b/node_modules/remove-array-items/README.md new file mode 100644 index 00000000..99aeda3e --- /dev/null +++ b/node_modules/remove-array-items/README.md @@ -0,0 +1,36 @@ +# remove-array-items + +remove items from a javascript array without generating memory garbage. + +[](https://travis-ci.org/mreinstein/remove-array-items) + +Despite there being a number of "remove array items" in npm, I couldn't find satisfying all criteria: + +* **doesn't generate garbage** +* **performs similar or better to the native `array.splice`** +* has tests +* es3+ compatible + +so here we are. + +originally inspired by https://gamealchemist.wordpress.com/2013/05/01/lets-get-those-javascript-arrays-to-work-fast/ + +(which is a gold mine for performant, non-garbage generating array operations by the way.) + + +## api + +```javascript +removeItems(arr, startIdx, removeCount) +``` + + +## usage + +```javascript +const removeItems = require('remove-array-items') + +const arr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ] + +removeItems(arr, 3, 4) // after running, arr === [ 1, 2, 3, 8, 9 ] +``` |
