Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

memoize-sync

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

memoize-sync

Return a memoized version of function.

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
34
increased by70%
Maintainers
1
Weekly downloads
 
Created
Source

memoize-sync

Returns a memoized version of a function.

Install

$ npm install memoize-sync

Usage

function work(n){
    console.log("doing some work")
    return n + 10
}

var memoizedWork = memoize(myfunc)

memoizedWork(10)
// "doing some work"
// => 20

memoizedWork(10)
// => 20

memoizedWork(20);
// "doing some work"
// => 30

memoizedWork(20);
// => 30

Using Hasher
var memoizedWork = memoize(work, hasher)

memoizedWork('hello', 'world')
// doing some work

memoizedWork('hello', 'world')
// => hello world

memoizedWork('hello', 'kitty')
// doing some work
// => hello kitty

memoizedWork('hello', 'kitty')
// => hello kitty

function hasher(first, last){
    return first + ', ' + last
}

function work(first, last){
    console.log('doing some work')

    return first + ', ' + last
}

FAQs

Package last updated on 31 Mar 2013

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc