# function-double

> Stand-in for a function

Latest version **1.0.4** (published 2018-07-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install function-double
pnpm add function-double
yarn add function-double
bun add function-double
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-07-21 |
| First published | 2018-03-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 133 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Anton Korzunov |
| Maintainers | kashey |
| Keywords | function, arity, descriptor, length |

## Links

- npm: https://www.npmjs.com/package/function-double
- Repository: https://github.com/theKashey/function-double
- Homepage: https://github.com/theKashey/function-double#readme
- Issues: https://github.com/theKashey/function-double/issues
- npm.io page: https://npm.io/package/function-double

## Dependencies (1)

- [util-arity](https://npm.io/package/util-arity.md) ^1.1.0

## Recent versions

- 1.0.4 (latest) — 2018-07-21
- 1.0.3 — 2018-07-03
- 1.0.2 — 2018-03-22
- 1.0.1 — 2018-03-22
- 1.0.0 — 2018-03-22

## README

function-double
=======
[![CircleCI status](https://img.shields.io/circleci/project/github/theKashey/function-double/master.svg?style=flat-square)](https://circleci.com/gh/theKashey/function-double/tree/master) [![Greenkeeper badge](https://badges.greenkeeper.io/theKashey/function-double.svg)](https://greenkeeper.io/)


Stands for the real function passing though all the descriptions and properties of the source function.

It is literally impossible to distinguish the real function, and it's double.

```js
import functionDouble from 'function-double';

const secretFunction = (a,b) => a+b;
secretFunction.propTypes = "this is not React";
const wrapperFunction = (...args) => secretFunction(...args) + 4;

secretFunction.length === 2
wrapperFunction.length === 0
wrapperFunction.propTypes === undefined

const result = functionDouble(wrapperFunction, secretFunction);

wrapperFunction.propTypes === "this is not React";
wrapperFunction.length === 2;


result === wrapperFunction;/ / But not in IE11 :)

```

## API
`functionDouble(targetFunction, sourceFunction, [options])` - moves all the stuff from sourceFunction to target.

- options.toString = (sourceFunction) => string. Override method for `toString`.
- options.name = (sourceFunction) => string. Override method for `name`.

## License

MIT

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