README
@bevry/memo
Wrap a function in a memo to reuse the first invocation result of the function
Usage
import memo from '@bevry/memo'
let count = 0
function counter() {
return ++count
}
const counterMemo = memo(counter)
counterMemo() // returns 1
counterMemo() // returns 1
Install
- Install:
npm install --save @bevry/memo
- Import:
import pkg from ('@bevry/memo')
- Require:
const pkg = require('@bevry/memo').default
<script type="module">
import pkg from '//cdn.skypack.dev/@bevry/memo@^3.16.0'
</script>
<script type="module">
import pkg from '//unpkg.com/@bevry/memo@^3.16.0'
</script>
<script type="module">
import pkg from '//dev.jspm.io/@bevry/memo@3.16.0'
</script>
Editions
This package is published with the following editions:
@bevry/memo/source/index.ts
is TypeScript source code with Import for modules@bevry/memo/edition-browsers/index.js
is TypeScript compiled against ES2020 for web browsers with Import for modules@bevry/memo
aliases@bevry/memo/edition-es2019/index.js
@bevry/memo/edition-es2019/index.js
is TypeScript compiled against ES2019 for Node.js 10 || 12 || 14 || 16 with Require for modules@bevry/memo/edition-es2019-esm/index.js
is TypeScript compiled against ES2019 for Node.js 12 || 14 || 16 with Import for modules
History
Discover the release history by heading on over to the HISTORY.md
file.
Contribute
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
Backers
Maintainers
These amazing people are maintaining this project:
Sponsors
No sponsors yet! Will you be the first?
Contributors
These amazing people have contributed code to this project:
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
License
Unless stated otherwise all works are:
- Copyright © 2019+ Benjamin Lupton
and licensed under: