Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/component/order-changed
Check if the order between two arrays has changed
https://github.com/component/order-changed
Last synced: 13 days ago
JSON representation
Check if the order between two arrays has changed
- Host: GitHub
- URL: https://github.com/component/order-changed
- Owner: component
- Created: 2013-06-03T20:19:08.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-12T02:19:14.000Z (about 11 years ago)
- Last Synced: 2024-05-08T17:10:48.368Z (8 months ago)
- Language: JavaScript
- Size: 115 KB
- Stars: 2
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# order-changed
Check if the order between two arrays has changed
## Installation
$ component install component/order-changed
## Examples
```js
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