# unexpected-function-equality

> Determine function equivalence by pretty-printing, then comparing the strings

Latest version **3.1.0** (published 2020-11-22) · BSD-3-Clause license · 0 weekly downloads

## Install

```sh
npm install unexpected-function-equality
pnpm add unexpected-function-equality
yarn add unexpected-function-equality
bun add unexpected-function-equality
```

## 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 | 3.1.0 |
| Published | 2020-11-22 |
| First published | 2015-10-07 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 19.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Andreas Lind |
| Maintainers | munter, joelmukuthu, gustavnikolaj, alexjeffburke, papandreou, sunesimonsen |
| Keywords | Unexpected, AST, esprima, function, equivalence, pretty-print |

## Links

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

## Dependencies (2)

- [esprima](https://npm.io/package/esprima.md) ^4.0.1
- [escodegen](https://npm.io/package/escodegen.md) ^2.0.0

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 3.1.0 (latest) — 2020-11-22
- 3.0.0 — 2020-06-28
- 2.0.1 — 2019-01-20
- 2.0.0 — 2018-06-24
- 1.0.1 — 2015-10-09
- 1.0.0 — 2015-10-07

## README

# unexpected-function-equality

[![NPM version](https://badge.fury.io/js/unexpected-function-equality.svg)](http://badge.fury.io/js/unexpected-function-equality)
[![Build Status](https://travis-ci.org/unexpectedjs/unexpected-function-equality.svg?branch=master)](https://travis-ci.org/unexpectedjs/unexpected-function-equality)
[![Coverage Status](https://coveralls.io/repos/unexpectedjs/unexpected-function-equality/badge.svg)](https://coveralls.io/r/unexpectedjs/unexpected-function-equality)
[![Dependency Status](https://david-dm.org/unexpectedjs/unexpected-function-equality.svg)](https://david-dm.org/unexpectedjs/unexpected-function-equality)

![Unexpected function(al) equality :)](http://40.media.tumblr.com/a39b945c1fa8a2429baf0d962919a11a/tumblr_my6qxb7Ogz1rcb0d2o1_1280.jpg)

Plugin for Unexpected 10+ that overrides the `<function> to equal <function>`
assertion with an implementation that disregards whitespace. This is
accomplished by parsing and pretty-printing the functions, then doing a string
comparison.

Example:

```js
var expect = require('unexpected')
  .clone()
  .use(require('unexpected-function-equality'));

it('should consider the two functions equal', function () {
  expect(
    function (a) {
      return 123 - 456;
    },
    'to equal',
    function (a) {
      return 123 - 456;
    }
  );
});
```

This is handy when testing code that generates code.

## Releases

[Changelog](https://github.com/unexpectedjs/unexpected-function-equality/blob/master/CHANGELOG.md)

## License

Unexpected-function-equality is licensed under a standard 3-clause BSD license -- see the `LICENSE` file for details.

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