Skip to content
Wrap a function in a memo to reuse the first invocation result of the function
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
source
.editorconfig
.gitignore
.npmignore
.travis.yml
CONTRIBUTING.md
HISTORY.md
LICENSE.md
README.md
package-lock.json
package.json
tsconfig.json

README.md

@bevry/memo

Travis CI Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
Patreon donate button Flattr donate button Liberapay donate button Thanks App donate button Boost Lab donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

Wrap a function in a memo to reuse the first invocation result of the function

Install

npm

  • Install: npm install --save @bevry/memo
  • Require: require('@bevry/memo')

jspm

<script type="module">
    import * as pkg from '//dev.jspm.io/@bevry/memo'
</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 for browsers with import for modules
  • @bevry/memo aliases @bevry/memo/edition-node-12/index.js
  • @bevry/memo/edition-node-12/index.js is typescript compiled for node.js 12 with require for modules

Usage

API Documentation.

const memo = require('@bevry/memo')

let count = 0
function counter() {
    return ++count
}

const counterMemo = memo(counter)

counterMemo() // returns 1
counterMemo() // returns 1

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:

  • Benjamin Lupton

Sponsors

No sponsors yet! Will you be the first?

Patreon donate button Flattr donate button Liberapay donate button Thanks App donate button Boost Lab donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

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:

You can’t perform that action at this time.