Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A library for general comparisons
JavaScript Shell Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
hooks
lib
test
.editorconfig
.eslintignore
.eslintrc
.gitignore
.jshintignore
.jshintrc
.jslintrc
Gemfile
Gruntfile.js
Guardfile
Guardfile-lint
README.md
package.json

README.md

cmp - A library for general comparisons

A comparison library for arbitrarily deep structures

EXAMPLE

$ node
> var cmp = require("cmp");
> cmp.cmp([1, 2, 3], [1, 2, 3]);
0
> cmp.eq([1, 2, 3], [1, 2, 3]);
true
> cmp.cmp([1, 2, 3], [1, 2, 3, 4]);
-1
> cmp.eq([1, 2, 3], [1, 2, 3, 4]);
false
> cmp.cmp("abc", "abc");
0
> cmp.eq("abc", "abc");
true
> cmp.cmp("abc", "abcdef");
-1
> cmp.eq("abc", "abcdef");
false

HOMEPAGE

https://github.com/mcandre/node-cmp

NPM

https://www.npmjs.com/package/cmp

REQUIREMENTS

Optional

DEVELOPMENT

Test

Ensure the logic is correct:

$ grunt test
...

Lint

Keep the code tidy:

$ grunt lint

Spell Check

$ grunt aspelllint

Local CI

Guard can automatically run testing when the code changes:

$ bundle
$ guard -G Guardfile
...

Guard can automatically lint when the code changes:

$ bundle
$ guard -G Guardfile-lint
...

Git Hooks

See hooks/.

Something went wrong with that request. Please try again.