# ap

> Currying in javascript. Like .bind() without also setting `this`.

Latest version **0.2.0** (published 2012-11-26) · MIT/X11 license · 0 weekly downloads

## Install

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

## 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.2.0 |
| Published | 2012-11-26 |
| First published | 2011-02-25 |
| Weekly downloads | 0 |
| License | MIT/X11 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | James Halliday |
| Maintainers | substack |
| Keywords | curry, apply, ap, bind, function, functional |

## Links

- npm: https://www.npmjs.com/package/ap
- Repository: http://github.com/substack/node-ap
- npm.io page: https://npm.io/package/ap

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2012-11-26
- 0.1.0 — 2012-06-25
- 0.0.1 — 2011-02-25

## README

ap
==

`Function.prototype.bind` sets `this` which is super annoying if you just want
to do currying over arguments while passing `this` through.

Instead you can do:

``` js
var ap = require('ap');
var z = ap([3], function (x, y) {
    return this.z * (x * 2 + y);
}).call({ z : 10 }, 4);
console.log(z);
```

***

```
100
```

methods
=======

``` js
var ap = require('ap')
```

## ap(args, fn)

Fill in the arguments `args` at the beginning of `fn`'s arguments list.

## ap.pa(args, fn)

Fill in the arguments `args` at the end of `fn`'s arguments list.

## ap.apa(left, right, fn)

Fill in `left` arguments starting from the beginning of `fn`'s argument list and
`right` arguments starting from the end.

## ap.partial(fn, args...)

Fill in `fn`'s arguments with `args...` from the beginning of `fn`'s arguments
list.

## ap.partialRight(fn, args...)

Fill in `fn`'s arguments with `args...` starting from the end of `fn`'s
arguments list.

## ap.curry(fn, args...)

Curry `fn`, returning a new function with `args...` partially applied from the
beginning of `fn`'s arguments list.

## ap.curryRight(fn, args...)

Curry `fn` returning a new function with `args...` partially applied from the
end of `fn`'s arguments list.

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