# @f/curry-transparently

> Curry functions, but expose their accumulated arguments and underlying function so that they can be meaningfully compared against one another

Latest version **1.0.0** (published 2016-10-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @f/curry-transparently
pnpm add @f/curry-transparently
yarn add @f/curry-transparently
bun add @f/curry-transparently
```

## 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 | 1.0.0 |
| Published | 2016-10-19 |
| First published | 2016-10-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | f |

## Links

- npm: https://www.npmjs.com/package/@f/curry-transparently
- Repository: https://github.com/micro-js/curry-transparently
- Homepage: https://github.com/micro-js/curry-transparently#readme
- Issues: https://github.com/micro-js/curry-transparently/issues
- npm.io page: https://npm.io/package/@f/curry-transparently

## Dependencies (1)

- [@f/extend](https://npm.io/package/@f/extend.md) ^1.0.0

## Recent versions

- 1.0.0 (latest) — 2016-10-19

## README

# curry-transparently

[![Build status][travis-image]][travis-url]
[![Git tag][git-image]][git-url]
[![NPM version][npm-image]][npm-url]
[![Code style][standard-image]][standard-url]

Curry functions, but expose their accumulated arguments and underlying function so that they can be meaningfully compared against one another

## Installation

    $ npm install @f/curry-transparently

## Usage

```js
const curry = require('@f/curry-transparently')

const curriedAdd = curry(add)
const add1 = add(1)
const add2 = add(2)

add1(3) === 4
add2(3) === 5

add1.$$fn === add
add1.$$args === [1]

add2.$$fn === add
add2.$$args === [2]

function add (a, b) {
  return a + b
}
```

## Why?

Traditional currying mechanisms isolate the information about what has been curried and what the underlying function is inside of an opaque closure. This prevents you from directly comparing two curried functions to determine their equivalence. This can be problematic for things like virtual DOM diffing where event handlers are constantly being created which, even though they may contain identical arguments and call an identical underlying function, are considered unique values.

Here's a comparator function to decide where two transparently curried functions are equivalent:

```javascript
var arrayEqual = require('@f/array-equal')

function compareFns (a, b) {
  return a.$$fn === b.$$fn && arrayEqual(a.$$args, b.$$args)
}
```

## API

### curryTransparently(fn, arity, args)

- `fn` - The function you want to curry
- `arity` - Optional, if not supplied `fn.length` will be used.
- `args` - Optional. An initial set of arguments to start out with.

**Returns:** A curried representation of `fn`, complete with `$$args` and `$$fn` properties that can be used to inspect it.

## License

MIT

[travis-image]: https://img.shields.io/travis/micro-js/curry-transparently.svg?style=flat-square
[travis-url]: https://travis-ci.org/micro-js/curry-transparently
[git-image]: https://img.shields.io/github/tag/micro-js/curry-transparently.svg?style=flat-square
[git-url]: https://github.com/micro-js/curry-transparently
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square
[standard-url]: https://github.com/feross/standard
[npm-image]: https://img.shields.io/npm/v/@f/curry-transparently.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@f/curry-transparently

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