array-comparer

1.0.5 • Public • Published

array-comparer

Compare two arrays based on some function.

Example

Here's a number array comparer :

const areArraysEqual = require("array-comparer");

function numberComparer(elementInFirstArray,symmetricElementInSecondArray){
  return elementInFirstArray === symmetricElementInSecondArray;
}  //Comparing function

areArraysEqual([2,3,5],[2,3,5],numberComparer); //true
areArraysEqual([2,3,5],[2,4,5],numberComparer); //false

You can write any comparing function and pass it to the areArraysEqual

Readme

Keywords

none

Package Sidebar

Install

npm i array-comparer

Weekly Downloads

3

Version

1.0.5

License

MIT

Unpacked Size

3.36 kB

Total Files

5

Last publish

Collaborators

  • hadichahine