# reselect-equality-check-n-parameters

> Only run the equality check on the first [n] arguments when using reselect

Latest version **0.2.0** (published 2017-10-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install reselect-equality-check-n-parameters
pnpm add reselect-equality-check-n-parameters
yarn add reselect-equality-check-n-parameters
bun add reselect-equality-check-n-parameters
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2017-10-06 |
| First published | 2017-03-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Cameron Batt |
| Maintainers | vespertilian |

## Links

- npm: https://www.npmjs.com/package/reselect-equality-check-n-parameters
- Repository: https://github.com/vespertilian/reselect-equality-check-n-parameters
- Homepage: https://github.com/vespertilian/reselect-equality-check-n-parameters#readme
- Issues: https://github.com/vespertilian/reselect-equality-check-n-parameters/issues
- npm.io page: https://npm.io/package/reselect-equality-check-n-parameters

## Recent versions

- 0.2.0 (latest) — 2017-10-06
- 0.1.1 — 2017-03-09
- 0.1.0 — 2017-03-05

## README

# reselect-equality-check-n-parameters

#### A simple memoize factory function that only checks equality on the first n parameters

To be used as an extension to the [reselect] library.

[reselect]: https://github.com/reactjs/reselect

## Install:
    npm install reselect-equality-check-n-parameters --save

## Example:
```js
    import { createSelectorCreator } from 'reselect';
    import { equalityCheckNParamsCreator } from 'reselect-equality-check-n-parameters';
    
    // This creates a memoize function that will only check the first parameter
    const equalityCheckFirstParam = equalityCheckNParamsCreator(1);

    // Import createSelectorCreator from the reselect library passing it the memoize function
    const createSelectorFirstParam = createSelectorCreator(equalityCheckFirstParam);

    const selector = createSelectorFirstParam(
        state => state.a,
        state => state.b,
        (a, b) => a + b
    );

    const state1 = {a: 1, b: 2};
    selector(state1); // would be 3
    
    // "b" will not be checked for equality
    // even if it has changed, no new value will be calculated
    const state2 = {a: 1, b: 4};
    selector(state2) // would be 3
    selector.recomputations() // would be 1
    
    const state3 = {a: 2, b: 4};
    selector(state3) // would be 6 as "a" has changed

```


## NPM tasks

- `npm test` runs the tests via karma
- `npm build` builds a UMD version for distribution with webpack
- `npm pre-publish` used when publishing to NPM

## Publishing checklist

1. Run tests `npm test`
2. Run build and check that your module was built (needs to be exported via index.ts to index.js)
3. Install it into your project to test before publishing by running `npm install '/path-to-this/'`
4. Bump version in package.json following [Semantic Versioning] SemVer
5. Tag the release commit in git: `git tag -a v0.1.5 -m "Published v0.1.5"`
6. Push the tags up to github: `git push origin --tags`
7. Publish `npm publish`

[Semantic Versioning]: http://semver.org/

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