# pure-bind

> Memoized function binding

Latest version **1.0.1** (published 2016-09-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install pure-bind
pnpm add pure-bind
yarn add pure-bind
bun add pure-bind
```

## 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.1 |
| Published | 2016-09-29 |
| First published | 2016-09-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | DzoQiEuoi |
| Maintainers | dzoqieuoi |
| Keywords | react, jsx, bind, memoize, pure |

## Links

- npm: https://www.npmjs.com/package/pure-bind
- Repository: https://github.com/DzoQiEuoi/pure-bind
- Homepage: https://github.com/DzoQiEuoi/pure-bind#readme
- Issues: https://github.com/DzoQiEuoi/pure-bind/issues
- npm.io page: https://npm.io/package/pure-bind

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-09-29
- 1.0.0 — 2016-09-25
- 0.0.1 — 2016-09-25

## README

# Pure Bind

Binds argments to functions with memoization of infinite depth.

## API

### Syntax

``bind(fnc, arg1[, arg2[, ...]])``

### Parameters

#### fnc
The function to be bound

#### arg1, arg2, ...
 The arguments to bind

### Returns

A copy of the function with the arguments bound to it and ``this`` set to ``undefined``. If these argument have been bound to the function before, a cached copy with the same reference is returned.

## Example usage

```
import bind from 'pure-bind';

class MyComponent extends React.Component {
    render() {
        return (
            <MySubComponent onClick={bind(setValue, 1)} />
        )
    }
}
```

No matter how many times MyComponent is rerendered, MySubComponent will always get an onClick prop with the same refernce allowing it to perform a strict equality check in its shouldComponentUpate logic.

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