@x-oasis/recycler
v0.1.38
Published
IntegerBufferSet function
Downloads
15
Readme
@x-oasis/recycler
Installation
$ npm i @x-oasis/recycler
How to use
import IntegerBufferSet from '@x-oasis/recycler'
How to run test
$ pnpm test
Philosophy
Basically, give an List index then get a placed position(recycler list index); In order to reuse more elements, object ref should be considered..
For Example, remove / delete / add an element, they all cause index change of original source data. but
API
updateIndices
updateIndices(props: {
/**
* index in range should not be recycled
*/
safeRange: {
startIndex: number;
endIndex: number;
};
startIndex: number;
maxCount: number;
step?: number;
/**
* return boolean value, true means the current processing index should be counted in.
*/
onProcess?: (type?: string, index?: number) => boolean
})