1.0.0 • Published 8 years ago

observ-sync-length v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

observ-sync-length Build Status

Sync the length of two observ-array arrays

Install

$ npm install --save observ-sync-length

Usage

var syncLength = require('observ-sync-length')
var ObservArray = require('observ-array')

var source = ObservArray([])
var destination = ObservArray([])

var unlisten = syncLength(source, destination)
source.push({})
destination().length
//=> 1

API

syncLength(source, destination, Constructor) -> function

Return an unlisten function.

source / destination

Required
Type: function

observ-array instances

Constructor

Type: function
Default: noop

A function to call to construct new items added to the destination when the length of the source grows.

License

MIT © Ben Drucker