# zames

> converts callback-based functions to Promises and apply currying to arguments

Latest version **3.0.0** (published 2019-09-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install zames
pnpm add zames
yarn add zames
bun add zames
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2019-09-20 |
| First published | 2016-11-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | coderaiser |
| Maintainers | coderaiser |
| Keywords | curry, promise, currify, promisify, function, arguments, callback |

## Links

- npm: https://www.npmjs.com/package/zames
- Repository: https://github.com/coderaiser/zames
- Homepage: http://github.com/coderaiser/zames
- Issues: https://github.com/coderaiser/zames/issues
- npm.io page: https://npm.io/package/zames

## Dependencies (2)

- [currify](https://npm.io/package/currify.md) ^4.0.0
- [es6-promisify](https://npm.io/package/es6-promisify.md) ^6.0.0

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 3.0.0 (latest) — 2019-09-20
- 2.0.1 — 2018-10-10
- 2.0.0 — 2018-05-03
- 1.1.3 — 2018-01-31
- 1.1.2 — 2016-12-17
- 1.1.1 — 2016-11-23
- 1.1.0 — 2016-11-17
- 1.0.1 — 2016-11-16
- 1.0.0 — 2016-11-16

## README

# Zames [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]

`zames` converts callback-based functions to Promises and apply currying to arguments.

`zames` = [currify][currify] + [promisify][promisify].

## Install

`npm i zames --save`

## API

### zames(fn [,ctx])

- `fn` - function
- `ctx` - context

`zames` can take just a `function`:

```js
const zames = require('zames');

const promise = zames((a, b, fn) => {
    fn(null, a + b);
});

const add = promise('hello ');

add('world').then((a) => {
    console.log(a);
    // output
    'hello world';
});

```

Or can be used with `ctx` as well:

```js
const ctx = {
    error: 'hello',
    log: function(a, b, fn) {
        fn(this.error);
    }
}

const withContext = zames(ctx.log, ctx);

withContext(1, 2)
    .catch((e) => {
        console.error(e.message);
        // output
        'hello';
    });

```

## Related

- [currify](https://github.com/coderaiser/currify "currify") - translate the evaluation of a function that takes multiple arguments into evaluating a sequence of functions, each with a single or more arguments.

- [fullstore](https://github.com/coderaiser/fullstore "fullstore") - functional variables.

- [wraptile](https://github.com/coderaiser/wraptile "wraptile") - translate the evaluation of a function that takes multiple arguments into evaluating a sequence of 2 functions, each with a any count of arguments.

## License

MIT

[NPMIMGURL]:                https://img.shields.io/npm/v/zames.svg?style=flat
[BuildStatusIMGURL]:        https://img.shields.io/travis/coderaiser/zames/master.svg?style=flat
[DependencyStatusIMGURL]:   https://img.shields.io/david/coderaiser/zames.svg?style=flat
[LicenseIMGURL]:            https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[NPMURL]:                   https://npmjs.org/package/zames "npm"
[BuildStatusURL]:           https://travis-ci.org/coderaiser/zames  "Build Status"
[DependencyStatusURL]:      https://david-dm.org/coderaiser/zames "Dependency Status"
[LicenseURL]:               https://tldrlegal.com/license/mit-license "MIT License"

[CoverageURL]:              https://coveralls.io/github/coderaiser/zames?branch=master
[CoverageIMGURL]:           https://coveralls.io/repos/coderaiser/zames/badge.svg?branch=master&service=github

[currify]:                 https://en.wikipedia.org/wiki/Currying "Currying"
[promisify]:                https://github.com/digitaldesignlabs/es6-promisify "Promisify"

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