1.1.2 • Published 9 years ago

comparray v1.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

#comparray

Node Module for comparing arrays

Build Status

NPM

##Syntax

comparray(array1, array2[, options])

array1, array2

Arrays to compare.

options (optional)

Options for the comparision.

##Output

When used without the options argument the module will return true if the two arrays are the same.

Optionally, returns an array determined by the options argument.

##Usage

Installation

$ npm install comparray

Basic Example

var comparray = require('comparray');

var array1 = [ 0, 1, 2, 3 ];
var array2 = [ 0, 1, 2, 3 ];

var result = comparray(array1, array2);     // result will be true

array2.push(4);

var result2 = comparray(array1, array2);    // result2 will be false

Example using options

var comparray = require('comparray');

var array1 = [ 0, 1, 2, 3 ];
var array2 = [ 0, 1 ];

var result = comparray(array1, array2, {show: 'missing'});     // result will be [ 2, 3 ]

var result2 = comparray(array1, array2, {show: 'common'});     // result2 will be [ 0, 1 ]

var result3 = comparray(array1, array2, {show: 'likeness'});   // result3 will be 0.5
1.1.2

9 years ago

1.1.0

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.1

10 years ago