Confer JS
Confer-JS is a tiny library that compares two ordered lists of objects and gives out the matched results.
Installation
npm install confer-js
Example usage
Using an Object structure
var confer = ;// Given a list of listsvar listOfLists = list1: e: 'element' 2 'anotherElement' list2: e: 'element' 1 'anotherElement' list3: e: 'element' 2 // We want to find all lists with these elements in this ordervar findList = e: 'element' 2var result =
Using an Array of Arrays structure
Confer-js also supports an array of array structure, if that is the case, the usage will be as follows:
var confer = ;// Given a list of listsvar listOfLists = e: 'element' 2 'anotherElement' e: 'element' 1 'anotherElement' e: 'element' 2 // We want to find all lists with these elements in this ordervar findList = e: 'element' 2var result =
Results
The result will contain a list matching the given data or an empty object or array, depending what was passed to the function:
// When listOfLists is an object.// When listOfLists is an array.[ [{ e: 'element'}, 2, 'anotherElement'], [{ e: 'element'}, 2]]