Skip to content

Commit

Permalink
Merge pull request #14 from keithamus/giant-refactor
Browse files Browse the repository at this point in the history
Giant refactor
  • Loading branch information
lucasfcosta authored Oct 9, 2016
2 parents b509572 + 1d2f040 commit 5794440
Show file tree
Hide file tree
Showing 19 changed files with 1,988 additions and 568 deletions.
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 <[email protected]> (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 <[email protected]>

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

0 comments on commit 5794440

Please sign in to comment.