Socket
Socket
Sign inDemoInstall

memoizee-decorator

Package Overview
Dependencies
14
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    memoizee-decorator

ES7 decorator for memoizee library


Version published
Weekly downloads
72
increased by50%
Maintainers
1
Install size
775 kB
Created
Weekly downloads
 

Readme

Source

memoizee-decorator

ES7 function decorator wrapper for the memoizee library (https://github.com/medikoo/memoizee).

Based on memoize-decorator (https://github.com/andreypopp/memoize-decorator). Using memoizee enables support for functions with arguments.

Also passes through memoizee options. For functions with parameters with default values, you have to set the length option explicitly, or use the option { length: false }

Usage

import memoize from 'memoizee-decorator';

class Foo {
  @memoize
  get bar() {
    console.log('Complicated calculations...');
    return 42;
  }

  @memoize({length:1})
  someFunc(num=21) {
    console.log('Complicated calculations...');
    return num;
  }

}

Can be used either plain @memoize or with options @memoize({...options})

As with all decorators, you have to use a transpiler. Refer to https://github.com/andreypopp/autobind-decorator#autobind-decorator for prerequisites.

Keywords

FAQs

Last updated on 30 Sep 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc