Skip to content
/ memo Public

Memoization with shallowly comparing object arguments

Notifications You must be signed in to change notification settings

luwes/memo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

Memoization with shallowly comparing object arguments

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published