11#spec-pattern
22
3- Implementation of the[ Specification Pattern] ( https://en.wikipedia.org/wiki/Specificationpattern ) for JavaScript and TypeScript.
3+ Implementation of the[ Specification Pattern] ( https://en.wikipedia.org/wiki/Specification_pattern ) for JavaScript and TypeScript.
44
5+ [ ![ npm version] ( https://badge.fury.io/js/spec-pattern.svg )] ( https://badge.fury.io/js/spec-pattern )
56[ ![ Build Status] ( https://travis-ci.org/thiagodp/spec-pattern.svg?branch=master )] ( https://travis-ci.org/thiagodp/spec-pattern ) [ ![ Greenkeeper badge] ( https://badges.greenkeeper.io/thiagodp/spec-pattern.svg )] ( https://greenkeeper.io/ )
67
78> Build complex filters and rules easily.
@@ -46,7 +47,7 @@ import { Between, In, GreaterThan } from 'spec-pattern';
4647
4748let rules= new Between (1 ,3 )
4849 .or (new Between (6 ,9 ) )
49- .or (new In ( [11 ,25 ,31 ] )
50+ .or (new In ( [11 ,25 ,31 ] ) )
5051 .or (new GreaterThan (50 ) );
5152
5253console .log (rules .isSatisfiedBy (2 ) );// true
@@ -55,6 +56,10 @@ console.log( rules.isSatisfiedBy( 5 ) ); // false
5556console .log (rules .isSatisfiedBy (11 ) );// true
5657console .log (rules .isSatisfiedBy (50 ) );// false
5758console .log (rules .isSatisfiedBy (51 ) );// true
59+
60+ // Printable !
61+ console .log (rules .toString () );
62+ // (((between (1, 3) or between (6, 9)) or in [11, 25, 31]) or greater than 50)
5863```
5964
6065####Not only numbers