1.0.4 • Published 7 years ago

universal-memoize v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

universal-memoize

A library of universal memoization for sync/async function. For async function, this library can just memoize the successful response of async request.

Installation

npm install universal-memoize --save

Usage

import memoize from 'universal-memoize'

// sync
const addOne = memoize(x => x + 1)
addOne(5).then(res => console.log(res)) // 6

//async
const fetchData = memoize(asyncFunc) //asyncFunc is your async function as 'uri => fetch(uri)'
fetchData(yourArgs).then(res => console.log(res))
1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago