abstract-pool

2.0.0 • Public • Published

abstract-pool

This is a simple, unopinionated module for creating and consuming pools of objects. It’s inspired by dom-pool, but can be used outside of DOM-based environments.

Build status

Install

$ npm install abstract-pool

Usage

var pool = require('abstract-pool')
 
var i = 0
var numbers = pool(function () {
  return ++i
})
 
numbers.alloc(5)
numbers.pop()
=> 5
 
var number = numbers.pop()
console.log(number)
=> 4
 
numbers.push(number)
numbers.pop()
=> 4
 
numbers.dealloc(2)
numbers.pop()
=> 1

page weight (browserified)

compression size
abstract-pool.js 1.17 kB
abstract-pool.min.js 882 B
abstract-pool.min.js.gz 433 B

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i abstract-pool

Weekly Downloads

2

Version

2.0.0

License

MIT

Last publish

Collaborators

  • michaelrhodes