0.0.0 • Published 5 years ago
memorize-one v0.0.0
memorize-one
Memorition function which return cache result when identity inputs.
Install
yarn add memorize-one
Usage
const memorizeOne = require('memorize-one')
let i = 0
const fn = () => ++i
const memoFn = memorizeOne(fn)
memoFn('input') // 1
memoFn('input') // 1
const a = { age: 1 }
a.obj = a
const b = { age: 1 }
b.obj = b
memoFn(a) // 2
memoFn(b) // 2
//=> foo
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
memorize-one © Eliaztray, Released under the MIT License. Authored and maintained by Eliaztray with help from contributors (list).
eliaztray · GitHub @Eliaztray · Twitter @eliaztray
0.0.0
5 years ago