1.0.0 • Published 8 years ago

tiny-store v1.0.0

Weekly downloads
7
License
-
Repository
github
Last release
8 years ago

tiny-store

Tiny immutable store for any value

Install

npm install tiny-store

Use

// create a fruit
let data = { fruit: 'apple' }
apple = store(data)

// try & change FAIL
console.log(apple()) // { fruit: 'apple' }
apple.fruit = 'pear'
console.log(apple()) // { fruit: 'apple' }
data.fruit = 'orange'
console.log(apple()) // { fruit: 'apple' }

// update
let grape = apple({ fruit: 'grape' })
console.log(grape()) // { fruit: 'grape' }
console.log(apple()) // { fruit: 'apple' }

License

MIT