This package has been deprecated

Author message:

This package is no longer maintained.

criteria-pattern-basics

0.0.9 • Public • Published

criteria-pattern-core

Library classes for the criteria-pattern package.

Provides the Criterion class which can be extended to satisfy the interface criterias expects and the Result class that each Criterion#call must return.

Installation

npm install --save criterias-basics

Usage

import Basics from 'criteria-pattern-basics';

This library provides the following Criterion:

Boolean

Casts its value to a boolean.

basics.boolean();

Number

Casts a value to a number.

basics.number();

String

Casts a value to a string.

basics.string();

Array

Splits a string into an array or wraps a value in one. You can pass a character to treat as the sperator.

basics.array(',')

Equals

Checks if the value is equal to the value supplied.

basics.equals(44).satisfy(33); // returns Failure

TypeOf

Checks if the value satisfies the type specified.

basics.typeOf('string').satisfy('a decent string'); // returns 'a decent string';

Match

Test the value against a regular expression.

basics.match(^/[\w]/).satisfy('@'); //returns Failure;

Range

Tests whether the value falls within a specific range.

basics.range(3, 14).satisfy(12); //returns 12; 

Readme

Keywords

Package Sidebar

Install

npm i criteria-pattern-basics

Weekly Downloads

2

Version

0.0.9

License

Apache-2.0

Last publish

Collaborators

  • metasansana