JSPM

@bevry/memo

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 27
  • Score
    100M100P100Q45993F
  • License MIT

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

Package Exports

  • @bevry/memo

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@bevry/memo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@bevry/memo

Travis CI Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
GitHub Sponsors donate button Patreon donate button Flattr donate button Liberapay 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
  • Import: import pkg from ('@bevry/memo')
  • Require: const pkg = require('@bevry/memo').default

pika

<script type="module">
    import pkg from '//cdn.pika.dev/@bevry/memo/^2.0.0'
</script>

unpkg

<script type="module">
    import pkg from '//unpkg.com/@bevry/memo@^2.0.0/edition-browsers/index.js'
</script>

jspm

<script type="module">
    import pkg from '//dev.jspm.io/@bevry/memo@2.0.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 ESNext for web browsers with Import for modules
  • @bevry/memo aliases @bevry/memo/edition-esnext/index.js
  • @bevry/memo/edition-esnext/index.js is TypeScript compiled against ESNext for Node.js with Require for modules

Environments older than Node.js v8 may need Babel's Polyfill or something similar.

Usage

API Documentation.

import memo from '@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?

GitHub Sponsors donate button Patreon donate button Flattr donate button Liberapay 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: