@watch-state/utils
v0.0.2
Published
Utils for watch-state
Maintainers
Readme
@watch-state/utils
Index
Overview
@watch-state/utils is a utility package for watch-state.
Index
Install
🏠︎ / Install
To get started with this package, run the following command:
npm i @watch-state/utilsuse
🏠︎ / use
The use function helps you retrieve the current value from an observable.
import { State } from 'watch-state'
import { use } from '@watch-state/utils'
const name = new State('Mike')
console.log(use(name)) // 'Mike'inject
🏠︎ / inject
The inject function allows you to transform observable value using a callback.
import { State } from 'watch-state'
import { inject } from '@watch-state/utils'
const name = new State('Mike')
console.log(inject('Mike', name => `Name: ${name}`)) // 'Name: Mike'
console.log(inject(name, name => `Name: ${name}`)) // () => 'Name: Mike'Links
You can find more tools here
Issues
If you find a bug or have a suggestion, please file an issue on GitHub
