Socket
Socket
Sign inDemoInstall

memo

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    memo

Memoization with shallowly comparing object arguments.


Version published
Maintainers
1
Install size
34.4 kB
Created

Readme

Source

memo

Memoization with shallowly comparing object arguments with support for document fragments.

Based on fast-memoize.js by Caio Gondim.

npm i memo
import { memo } from 'memo';

let called = 0
const memoized = memo(
  a => {
    called++
    return a
  }
)
let obj = { a: 9 }
console.log(memoized(obj) === obj)
console.log(memoized({ a: 9 }) === obj)
console.log(called === 1)

let obj2 = { a: 7 }
console.log(memoized(obj2) === obj2)
console.log(called === 2)

Keywords

FAQs

Last updated on 26 Apr 2020

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