# node-memoza

> Function memoise

Latest version **0.9.0** (published 2017-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-memoza
pnpm add node-memoza
yarn add node-memoza
bun add node-memoza
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.0 |
| Published | 2017-06-05 |
| First published | 2017-03-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6.2 |
| Dependencies | 8 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | baleevskiy |
| Maintainers | baleevskiy |

## Links

- npm: https://www.npmjs.com/package/node-memoza
- Repository: https://github.com/baleevskiy/memoza
- Issues: https://github.com/baleevskiy/memoza/issues
- npm.io page: https://npm.io/package/node-memoza

## Dependencies (8)

- [cbw](https://npm.io/package/cbw.md) ^0.0.1
- [sinon](https://npm.io/package/sinon.md) ^2.1.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [rimraf](https://npm.io/package/rimraf.md) ^2.6.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^2.1.2
- [jsonfile](https://npm.io/package/jsonfile.md) ^2.4.0
- [fs-promise](https://npm.io/package/fs-promise.md) ^2.0.2
- [node-serialize](https://npm.io/package/node-serialize.md) ^0.0.4

## Recent versions

- 0.9.0 (latest) — 2017-06-05
- 0.8.0 — 2017-06-04
- 0.7.0 — 2017-04-05
- 0.6.0 — 2017-03-31
- 0.5.1 — 2017-03-30
- 0.5.0 — 2017-03-30
- 0.4.0 — 2017-03-29
- 0.3.2 — 2017-03-28
- 0.3.1 — 2017-03-27
- 0.3.0 — 2017-03-27

## README

# Memoza
[![Build Status](https://travis-ci.org/baleevskiy/memoza.svg?branch=master)](https://travis-ci.org/baleevskiy/memoza)
[![Code Climate](https://codeclimate.com/github/baleevskiy/memoza/badges/gpa.svg)](https://codeclimate.com/github/baleevskiy/memoza)
[![Test Coverage](https://codeclimate.com/github/baleevskiy/memoza/badges/coverage.svg)](https://codeclimate.com/github/baleevskiy/memoza/coverage)
### Description

Like `_.memoize` this one allows to cache functions and
stores the results in FS.

### Configuration
```javascript
const memoza = require('node-memoza');
const wrapper = memoza({ cache: { path: cachePath } });
```

 1. Remembers cb's arguments
 ```javascript
 const func = (param1, cb) => {
  setTimeout(() => { cb(param1); }, 10000);
 }
 const wrapped = wrapper(func);
 wrapped(1234, (param) => console.log(param)); //will log "1234" in 10 seconds
 // ...once cb called
 wrapped(1234, (param) => console.log(param)); //will log "1234" without delay
 ```

 2. Remembers Promise resolution value

 ```javascript
const func = (param1) => {
  return new Promise((resolve) => {
    setTimeout(() => { resolve(param1); }, 10000);
  });
 }
 const wrapped = wrapper(func);
 wrapped(1234).then((param) => console.log(param)); //will log "1234" in 10 seconds
 wrapped(1234).then((param) => console.log(param)); // ...once promise has been resolved it will log "1234"
 ```

---
_Source: https://npm.io/package/node-memoza · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
