Skip to content

Node comparison is a lightweight tool for compare any type of arguments with keyword, written on node.js

Notifications You must be signed in to change notification settings

tankhuu/node-comparison

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node Comparison

Node-comparison is a lightweight tool for compare any type of arguments with keyword, written on node.js

Installation

install node-comparison via npm

npm install node-comparison

Overview

Node-comparison takes arguments written in JSON friendly format as input. Arguments could be many types of data (number, string, boolean, date, ...) with a humanity operator format in String (Number "equal" Number, Date "before" Date, ...), return value is the boolean of the comparison result.

Use the common package to handle the comparison

string.js moment.js

Supported types: number, date, boolean, string
Supported operators:
  • number: ['equal', 'notEqual', 'lessThan', 'lessThanOrEqual', 'greaterThan', 'greaterThanOrEqual', 'between'],
  • date: ['on', 'before', 'after', 'onOrBefore', 'onOrAfter', 'within'],
  • boolean: ['equal', 'notEqual'],
  • string: ['is', 'startWith', 'contains']

Usage

var compare = require('node_comparison').compare; console.log('compare result'); console.log(compare('date', 'within', new Date(2017, 1, 20), new Date(2017, 1, 19), new Date(2017, 1, 23)));

About

Node comparison is a lightweight tool for compare any type of arguments with keyword, written on node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published