new-object

Objects with PubSub

Objects with PubSub Interface

$ npm install new-object
prices = newObject({ apple: 3, grape: 4 })
prices('banana', 1)
 
prices('apple')
// => 3 
 
prices('banana', 4)

Subscribing to changes:

prices('cherry', 5)
prices('apple', 2)
prices.rm('banana')
 
prices.subscribe(function(update){
 
    update.set
    { cherry: 5, apple: 2 }
 
    update.rm
    ['banana']
 
})