Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Check if the order between two arrays has changed
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
History.md
Makefile
Readme.md
component.json
index.js
package.json
test.js

Readme.md

order-changed

Check if the order between two arrays has changed

Installation

$ component install component/order-changed

Examples

var assert = require('assert');
var changed = require('./');

var a = [];
var b = [];

assert(false == changed(a, b), 'empty');


var a = ['foo', 'bar', 'baz'];
var b = ['foo', 'baz'];

assert(false == changed(a, b), 'removing one');


var a = ['foo', 'bar', 'baz'];
var b = ['foo', 'bar', 'baz', 'raz'];

assert(false == changed(a, b), 'adding one');


var a = ['foo', 'bar', 'baz'];
var b = ['foo'];

assert(false == changed(a, b), 'removing two');


var a = ['foo', 'bar', 'baz'];
var b = [];

assert(false == changed(a, b), 'removing all');


var a = ['foo', 'bar', 'baz'];
var b = ['hey', 'foo', 'bar', 'baz'];

assert(true == changed(a, b), 'prepend');


var a = ['foo', 'bar', 'baz'];
var b = ['bar', 'foo', 'baz'];

assert(true == changed(a, b), 're-order');

License

MIT

Something went wrong with that request. Please try again.