1.0.0 • Published 6 years ago

supercomparator v1.0.0

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

This is a library containing functions for comparing two lists. The comparators determine whether items should be added, dropped, or updated based on a set of comparators.

===Installation=== npm install --save supercomp

After installation, include it using:

var supercomp = require('supercomp');

or

import supercomp from 'supercomp';

===USAGE===

Supercomp may be used by calling a compare function that will in turn call several other functions and return the results of those functions in an object of arrays.

{ adds: ..., drops: ..., updates: ... }

Each of the functions may be called individually: adds, drops, updates.

For both adds and drops, the method parameters are as follows:

c_list: a comparator list that will be used to compare against a master list; m_list: the master list used for comparison; c_comparator: a comparator that is contained in each item of the comparator list used to compare against items in the master list; and m_comparator: a comparator that is contained in each item of the master list.

For updates, there is one more parameter titled "fields". The fields parameters is an array of arrays containing fields that will compare against the c_list and the m_list.

Example:

[c_comparator1, m_comparator2,c_comparator3,m_comparator4,...]

1.0.0

6 years ago