2.0.0 • Published 9 years ago

abstract-pool v2.0.0

Weekly downloads
7
License
MIT
Repository
github
Last release
9 years ago

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)

compressionsize
abstract-pool.js1.17 kB
abstract-pool.min.js882 B
abstract-pool.min.js.gz433 B

License

MIT