1
+ :question :
1
2
[ @aureooms/js-predicate ] ( https://aureooms.github.io/js-predicate )
2
3
==
3
4
4
- Predicate code bricks for JavaScript.
5
+ Predicates for JavaScript.
6
+ See [ docs] ( https://aureooms.github.io/js-predicate ) .
7
+
8
+ ``` js
9
+ implication ( negation ( lt ( 7 ) ) , gt ( 5 ) )( ... ) ; // true
10
+ ```
5
11
6
12
[ ![ License] ( https://img.shields.io/github/license/aureooms/js-predicate.svg )] ( https://raw.githubusercontent.com/aureooms/js-predicate/main/LICENSE )
7
13
[ ![ Version] ( https://img.shields.io/npm/v/@aureooms/js-predicate.svg )] ( https://www.npmjs.org/package/@aureooms/js-predicate )
@@ -18,124 +24,6 @@ Predicate code bricks for JavaScript.
18
24
[ ![ Documentation] ( https://aureooms.github.io/js-predicate//badge.svg )] ( https://aureooms.github.io/js-predicate//source.html )
19
25
[ ![ Package size] ( https://img.shields.io/bundlephobia/minzip/@aureooms/js-predicate )] ( https://bundlephobia.com/result?p=@aureooms/js-predicate )
20
26
21
- Can be managed through [ jspm] ( https://github.com/jspm/jspm-cli ) ,
22
- [ duo] ( https://github.com/duojs/duo ) ,
23
- [ component] ( https://github.com/componentjs/component ) ,
24
- [ bower] ( https://github.com/bower/bower ) ,
25
- [ ender] ( https://github.com/ender-js/Ender ) ,
26
- [ jam] ( https://github.com/caolan/jam ) ,
27
- [ spm] ( https://github.com/spmjs/spm ) ,
28
- and [ npm] ( https://github.com/npm/npm ) .
29
-
30
- ## Install
31
-
32
- ### jspm
33
- ``` terminal
34
- jspm install github:aureooms/js-predicate
35
- # or
36
- jspm install npm:@aureooms/js-predicate
37
- ```
38
- ### duo
39
- No install step needed for duo!
40
-
41
- ### component
42
- ``` terminal
43
- component install aureooms/js-predicate
44
- ```
45
-
46
- ### bower
47
- ``` terminal
48
- bower install @aureooms/js-predicate
49
- ```
50
-
51
- ### ender
52
- ``` terminal
53
- ender add @aureooms/js-predicate
54
- ```
55
-
56
- ### jam
57
- ``` terminal
58
- jam install @aureooms/js-predicate
59
- ```
60
-
61
- ### spm
62
- ``` terminal
63
- spm install @aureooms/js-predicate --save
64
- ```
65
-
66
- ### npm
67
- ``` terminal
68
- npm install @aureooms/js-predicate --save
69
- ```
70
-
71
- ## Require
72
- ### jspm
73
- ``` js
74
- let predicate = require ( " github:aureooms/js-predicate" ) ;
75
- // or
76
- import predicate from ' @aureooms/js-predicate' ;
77
- ```
78
- ### duo
79
- ``` js
80
- let predicate = require ( " aureooms/js-predicate" ) ;
81
- ```
82
-
83
- ### component, ender, spm, npm
84
- ``` js
85
- let predicate = require ( " @aureooms/js-predicate" ) ;
86
- ```
87
-
88
- ### bower
89
- The script tag exposes the global variable ` predicate ` .
90
- ``` html
91
- <script src =" bower_components/@aureooms/js-predicate/js/dist/predicate.min.js" ></script >
92
- ```
93
- Alternatively, you can use any tool mentioned [ here] ( http://bower.io/docs/tools/ ) .
94
-
95
- ### jam
96
- ``` js
97
- require ( [ " @aureooms/js-predicate" ] , function ( predicate ) { ... } ) ;
98
- ```
99
-
100
- ## Use
101
-
102
- ``` js
103
- const {
104
- lt , le , gt ,
105
- truth , untruth ,
106
- negation ,
107
- conjunction , disjunction ,
108
- implication
109
- } = predicate ;
110
-
111
- let p = gt ( 5 ) ;
112
- p ( 5 ) ; // false
113
- p ( 6 ) ; // true
114
-
115
- let q = lt ( 7 ) ;
116
- q ( 6 ) ; // true
117
- q ( 7 ) ; // false
118
-
119
- let r = conjunction ( p , q ) ;
120
- r ( 5 ) ; // false
121
- r ( 6 ) ; // true
122
- r ( 7 ) ; // false
123
-
124
- let s = negation ( r ) ;
125
- s ( 5 ) ; // true
126
- s ( 6 ) ; // false
127
- s ( 7 ) ; // true
128
-
129
- let t = equivalence ( p , negation ( le ( 5 ) ) ) ;
130
- t ( ... ) ; // true
131
-
132
- let u = implication ( negation ( q ) , p ) ;
133
- u ( ... ) ; // true
134
-
135
- let v = disjunction ( truth , untruth ) ;
136
- v ( ... ) ; // true
137
- ```
138
-
139
- ## References
27
+ ## :link : Related
140
28
141
29
- https://github.com/jamestalmage/predicate-js
0 commit comments