tiny-store
v1.0.0
Published
Tiny immutable store for any value
Downloads
1
Readme
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