paramatcher

0.0.2 • Public • Published

#paramatcher

Description:

A simple object parameter matcher.

This tool allows checking object properties using preset boolean rules. For example, checking that all required parameters exist in the expected combination.

Basic Usage:

Installation

npm install paramatcher

Import library:

var paramatcher = require('paramatcher');

Define match rules (here without conditions):

Build with a string:

var validPassport = paramatcher.build('nationality && (passportNumber || (name && age))');

Test against a real a list of parameters

var Bob =  {
    nationality : 'English',
    name : 'Bob',
    age : 100
};

validPassport.test(Bob); // true

// don't have personal info but have passport number
var Anon =  {
    nationality : 'English',
    passportNumber : 'GHSJE3423'
};

validPassport.test(Bob); // true

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i paramatcher

Weekly Downloads

0

Version

0.0.2

License

ISC

Last publish

Collaborators

  • eurochriskelly