1.0.0 • Published 3 years ago

round-robin-list v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

RoundRobin List

round-robin list is a Weighted Round Robin resource pool with the possibility to select the starting resource

Using

npm install roundrobin-list

Basic usage

const { RoundRobinList } = require('roundrobin-list');

// Without initial values
const listWithoutValues = new RoundRobinList();

listWithoutValues.add({ value: 'A', weight: 3 });
listWithoutValues.add({ value: 'B', weight: 2 });
listWithoutValues.add({ value: 'C', weight: 2 });

// With values 
const listWithValues = new RoundRobinList([
    { value: 'A', weight: 4 },
    { value: 'B', weight: 3 },
    { value: 'C', weight: 2 },
]);

License

MIT

1.0.0

3 years ago