Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Giant refactor #14

Merged
merged 26 commits into from
Oct 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0e9d94d
refactor: remove samevalue in favour of object-is dep
keithamus Feb 28, 2016
790dc4e
chore(build): add eslint
keithamus Feb 28, 2016
c2f48ac
test: refactor test suites
keithamus May 5, 2016
ef1af9e
chore(build): add Browserify scripts to build browser version
keithamus May 5, 2016
db9be52
chore(build): reintroduce code coverage via istanbul & coveralls
keithamus May 5, 2016
e54aa38
chore(build): Remove redundant makefile
keithamus May 5, 2016
788d5b7
chore(build): move to semantic-release builds
keithamus May 5, 2016
346704d
chore: add LICENSE file
keithamus May 5, 2016
c7fe5fb
chore: remove history.md
keithamus May 5, 2016
23d6079
chore(package): remove npmignore in favour of files
keithamus May 5, 2016
9960705
chore(package): add contributors
keithamus May 5, 2016
98bc199
chore(package): upgrade type-detect to 2.0.0
keithamus May 5, 2016
3c1ed35
chore(package): pin simple-assert to ^1.0.0
keithamus May 5, 2016
5d6124b
feat: clean up and move lib/eql.js to index.js
keithamus May 5, 2016
62d3745
test(bench): add benchmark tests
keithamus May 5, 2016
8e59dbc
docs: improve readme docs
keithamus May 5, 2016
9395df2
perf: remove argumentsEqual in favour of using iterableEqual for bett…
keithamus Jun 1, 2016
7e66106
fix: add conformance function for sets to support IE11
keithamus Jun 1, 2016
8a3b1ff
fix(generator): ensure generators compare in mixed states
keithamus Jul 3, 2016
0fb00d2
style: small code layout improvements
keithamus Jul 3, 2016
561c76f
feat: add Comparator and Memoize options
keithamus Sep 14, 2016
8e1bdae
perf: improve Map performance with dedicated mapEqual function
keithamus Sep 14, 2016
a222cd8
chore(travis): reconfigure secure vars
keithamus Sep 14, 2016
5c442a5
chore(build): test on all officially supported node versions
keithamus Oct 8, 2016
b504f6a
perf: improve performance on some primitives
keithamus Oct 4, 2016
1d2f040
perf: a range of performance improvements
keithamus Oct 8, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ components
node_modules
npm-debug.log

coverage.html
coverage/

deep-eql.js
11 changes: 0 additions & 11 deletions .npmignore

This file was deleted.

29 changes: 27 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
sudo: false
language: node_js
addons:
sauce_connect: true
cache:
directories:
- node_modules
node_js:
- 0.10
script: make test-travisci
- 0.10 # to be removed 2016-10-31
- 0.12 # to be removed 2016-12-31
- 4 # to be removed 2018-04-01
- 6 # to be removed 2019-04-01
- lts/* # safety net; don't remove
- node # safety net; don't remove
before_install:
- npm i -g npm
script:
- npm t
after_success:
- npm run upload-coverage
- travis-after-all && npm run semantic-release
env:
global:
- SAUCE_CONNECT_READY_FILE=/tmp/sauce-connect-ready
- LOGS_DIR=/tmp/chai-build/logs
- secure: fOmukdZc9lwl/tfer01TAoPCcpafNbr1ZvUnjKmiP/r1cC2RWpF1JlYITtioLlvadzCTwi88SBzQLIi1/qCSao7vSsup5oC05brgUOR9uD7VE9IfIpyV5bthT/sX3IKNeIFKlow4H1f8RLlweqtor5AyHlG5cXOJybQMyAAfkWo=
- secure: XC9Uz7J9Yflf7NuSFAkWq2yb3UksnKe83l3npLhYWN/uNk74ukh1z3o+OcJ4ujNsMx+/AcKjlJPmu8ghrjxCo6ocWBNz2+TR2UOZjukS96BOAOvOTgJqEv6nGW7HNVhpDYZEPbhM2d67UnoAX3aZFDZdug2EHD2GFJYYD7LZpnM=
- secure: LsutIKfCxltpyJSW0h+L8EDQYC+Rh7w48ZBbbJq+jS19ejQTPfojvvw5NcucpNh0P+x27PikRGKNOAAUuPqZSA9l9OFPoPVxgUI8r8E7Kl6D0pi6hCz5bX+dG0VaI078GpaflsyOVjiiW844sR7IXpP1w3GP2fI1DBXOBUbsWNQ=
- secure: EqyK5QPQZ7eHu7RbRjj/1MJywBbsn7EiJXHm9jjDnsuLkMEhrBdV5bYsIEDIROIsOSl8OBw208rrIUNO73aSvfQgkCJMN3Mtjfqh/Yn1We90k0Gy9KZMsiheD/3qjsOQxQPludlU58EDlEItTVLb2Clfs7Qfv7M5p3xl54OCaN8=
28 changes: 0 additions & 28 deletions History.md

This file was deleted.

19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2013 Jake Luer <jake@alogicalparadox.com> (http://alogicalparadox.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
73 changes: 0 additions & 73 deletions Makefile

This file was deleted.

118 changes: 85 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,86 @@
# deep-eql [![Build Status](https://travis-ci.org/chaijs/deep-eql.png?branch=master)](https://travis-ci.org/chaijs/deep-eql) [![Coverage Status](https://coveralls.io/repos/chaijs/deep-eql/badge.png?branch=master)](https://coveralls.io/r/chaijs/deep-eql?branch=master)

> Improved deep equality testing for Node.js and the browser.
<h1 align=center>
<a href="http://chaijs.com" title="Chai Documentation">
<img alt="ChaiJS" src="http://chaijs.com/img/chai-logo.png"/> deep-eql
</a>
</h1>

<p align=center>
Improved deep equality testing for [node](http://nodejs.org) and the browser.
</p>

<p align=center>
<a href="./LICENSE">
<img
alt="license:mit"
src="https://img.shields.io/badge/license-mit-green.svg?style=flat-square"
/>
</a><a href="https://github.com/chaijs/deep-eql/releases">
<img
alt="tag:?"
src="https://img.shields.io/github/tag/chaijs/deep-eql.svg?style=flat-square"
/>
</a><a href="https://travis-ci.org/chaijs/deep-eql">
<img
alt="build:?"
src="https://img.shields.io/travis/chaijs/deep-eql/master.svg?style=flat-square"
/>
</a><a href="https://coveralls.io/r/chaijs/deep-eql">
<img
alt="coverage:?"
src="https://img.shields.io/coveralls/chaijs/deep-eql/master.svg?style=flat-square"
/>
</a><a href="https://www.npmjs.com/packages/deep-eql">
<img
alt="code quality:?"
src="https://img.shields.io/codacy/6de187aa62274dbea6e69a3c27e798da.svg?style=flat-square"
/>
</a><a href="https://www.npmjs.com/packages/deep-eql">
<img
alt="dependencies:?"
src="https://img.shields.io/npm/dm/deep-eql.svg?style=flat-square"
/>
</a><a href="">
<img
alt="devDependencies:?"
src="https://img.shields.io/david/chaijs/deep-eql.svg?style=flat-square"
/>
</a>
<br/>
<a href="https://saucelabs.com/u/chaijs-deep-eql">
<img
alt="Selenium Test Status"
src="https://saucelabs.com/browser-matrix/chaijs-deep-eql.svg"
/>
</a>
<br>
<a href="https://chai-slack.herokuapp.com/">
<img
alt="Join the Slack chat"
src="https://img.shields.io/badge/slack-join%20chat-E2206F.svg?style=flat-square"
/>
</a>
<a href="https://gitter.im/chaijs/deep-eql">
<img
alt="Join the Gitter chat"
src="https://img.shields.io/badge/gitter-join%20chat-D0104D.svg?style=flat-square"
/>
</a>
</p>

## What is Deep-Eql?

Deep Eql is a module which you can use to determine if two objects are "deeply" equal - that is, rather than having referential equality (`a === b`), this module checks an object's keys recursively, until it finds primitives to check for referential equality. For more on equality in JavaScript, read [the comparison operators article on mdn](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators).

As an example, take the following:

```js
1 === 1 // These are primitives, they hold the same reference - they are strictly equal
1 == '1' // These are two different primitives, through type coercion they hold the same value - they are loosely equal
{ a: 1 } !== { a: 1 } // These are two different objects, they hold different references and so are not strictly equal - even though they hold the same values inside
{ a: 1 } != { a: 1 } // They have the same type, meaning loose equality performs the same check as strict equality - they are still not equal.

deepEql({ a: 1 }, { a: 1 }) === true // deepEql can determine that they share the same keys and those keys share the same values, therefore they are deeply equal!
```

## Installation

Expand All @@ -10,14 +90,10 @@

$ npm install deep-eql

### Component

`deep-eql` is available as a [component](https://github.com/component/component).

$ component install chaijs/deep-eql

## Usage

The primary export of `deep-eql` is function that can be given two objects to compare. It will always return a boolean which can be used to determine if two objects are deeply equal.

### Rules

- Strict equality for non-traversable nodes according to [egal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
Expand All @@ -26,27 +102,3 @@
- Arguments are not Arrays:
- `eql([], arguments).should.be.false;`
- `eql([], Array.prototype.slice.call(arguments)).should.be.true;`

## License

(The MIT License)

Copyright (c) 2013 Jake Luer <jake@alogicalparadox.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
17 changes: 17 additions & 0 deletions bench/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": [ "strict/test" ],
"env": {
"node": true,
"browser": true,
"es6": true
},
"rules": {
"no-new-wrappers": 0,
"no-array-constructor": 0,
"no-new-object": 0,
"no-empty-function": 0,
"no-undefined": 0,
"no-console": 0,
"id-length": 0
}
}
Loading