@@ -51,6 +51,8 @@ Combines two predicates into a new predicate that returns `true` if both of the
51
51
52
52
• ** that** : [ ` Refinement ` ] ( ../interfaces/Refinement.md ) \< ` A ` , ` C ` \>
53
53
54
+ A predicate.
55
+
54
56
### Returns
55
57
56
58
` Function `
@@ -75,7 +77,20 @@ A predicate.
75
77
76
78
A predicate.
77
79
78
- ### Example
80
+ ### Examples
81
+
82
+ ``` ts
83
+ import { Predicate } from " effect"
84
+
85
+ const minLength = (n : number ) => (s : string ) => s .length >= n
86
+ const maxLength = (n : number ) => (s : string ) => s .length <= n
87
+
88
+ const length = (n : number ) => Predicate .and (minLength (n ), maxLength (n ))
89
+
90
+ assert .deepStrictEqual (length (2 )(" aa" ), true )
91
+ assert .deepStrictEqual (length (2 )(" a" ), false )
92
+ assert .deepStrictEqual (length (2 )(" aaa" ), false )
93
+ ```
79
94
80
95
``` ts
81
96
import { Predicate } from " effect"
@@ -94,6 +109,10 @@ assert.deepStrictEqual(length(2)("aaa"), false)
94
109
95
110
2.0.0
96
111
112
+ ### Since
113
+
114
+ 2.0.0
115
+
97
116
## and(self, that)
98
117
99
118
> ** and** \< ` A ` , ` B ` , ` C ` \> (` self ` , ` that ` ): [ ` Refinement ` ] ( ../interfaces/Refinement.md ) \< ` A ` , ` B ` & ` C ` \>
@@ -112,8 +131,12 @@ Combines two predicates into a new predicate that returns `true` if both of the
112
131
113
132
• ** self** : [ ` Refinement ` ] ( ../interfaces/Refinement.md ) \< ` A ` , ` B ` \>
114
133
134
+ A predicate.
135
+
115
136
• ** that** : [ ` Refinement ` ] ( ../interfaces/Refinement.md ) \< ` A ` , ` C ` \>
116
137
138
+ A predicate.
139
+
117
140
### Returns
118
141
119
142
[ ` Refinement ` ] ( ../interfaces/Refinement.md ) \< ` A ` , ` B ` & ` C ` \>
@@ -126,7 +149,20 @@ A predicate.
126
149
127
150
A predicate.
128
151
129
- ### Example
152
+ ### Examples
153
+
154
+ ``` ts
155
+ import { Predicate } from " effect"
156
+
157
+ const minLength = (n : number ) => (s : string ) => s .length >= n
158
+ const maxLength = (n : number ) => (s : string ) => s .length <= n
159
+
160
+ const length = (n : number ) => Predicate .and (minLength (n ), maxLength (n ))
161
+
162
+ assert .deepStrictEqual (length (2 )(" aa" ), true )
163
+ assert .deepStrictEqual (length (2 )(" a" ), false )
164
+ assert .deepStrictEqual (length (2 )(" aaa" ), false )
165
+ ```
130
166
131
167
``` ts
132
168
import { Predicate } from " effect"
@@ -145,6 +181,10 @@ assert.deepStrictEqual(length(2)("aaa"), false)
145
181
146
182
2.0.0
147
183
184
+ ### Since
185
+
186
+ 2.0.0
187
+
148
188
## and(that)
149
189
150
190
> ** and** \< ` A ` \> (` that ` ): (` self ` ) => [ ` Predicate ` ] ( ../interfaces/Predicate.md ) \< ` A ` \>
@@ -159,6 +199,8 @@ Combines two predicates into a new predicate that returns `true` if both of the
159
199
160
200
• ** that** : [ ` Predicate ` ] ( ../interfaces/Predicate.md ) \< ` A ` \>
161
201
202
+ A predicate.
203
+
162
204
### Returns
163
205
164
206
` Function `
@@ -179,7 +221,20 @@ A predicate.
179
221
180
222
A predicate.
181
223
182
- ### Example
224
+ ### Examples
225
+
226
+ ``` ts
227
+ import { Predicate } from " effect"
228
+
229
+ const minLength = (n : number ) => (s : string ) => s .length >= n
230
+ const maxLength = (n : number ) => (s : string ) => s .length <= n
231
+
232
+ const length = (n : number ) => Predicate .and (minLength (n ), maxLength (n ))
233
+
234
+ assert .deepStrictEqual (length (2 )(" aa" ), true )
235
+ assert .deepStrictEqual (length (2 )(" a" ), false )
236
+ assert .deepStrictEqual (length (2 )(" aaa" ), false )
237
+ ```
183
238
184
239
``` ts
185
240
import { Predicate } from " effect"
@@ -198,6 +253,10 @@ assert.deepStrictEqual(length(2)("aaa"), false)
198
253
199
254
2.0.0
200
255
256
+ ### Since
257
+
258
+ 2.0.0
259
+
201
260
## and(self, that)
202
261
203
262
> ** and** \< ` A ` \> (` self ` , ` that ` ): [ ` Predicate ` ] ( ../interfaces/Predicate.md ) \< ` A ` \>
@@ -212,8 +271,12 @@ Combines two predicates into a new predicate that returns `true` if both of the
212
271
213
272
• ** self** : [ ` Predicate ` ] ( ../interfaces/Predicate.md ) \< ` A ` \>
214
273
274
+ A predicate.
275
+
215
276
• ** that** : [ ` Predicate ` ] ( ../interfaces/Predicate.md ) \< ` A ` \>
216
277
278
+ A predicate.
279
+
217
280
### Returns
218
281
219
282
[ ` Predicate ` ] ( ../interfaces/Predicate.md ) \< ` A ` \>
@@ -226,7 +289,20 @@ A predicate.
226
289
227
290
A predicate.
228
291
229
- ### Example
292
+ ### Examples
293
+
294
+ ``` ts
295
+ import { Predicate } from " effect"
296
+
297
+ const minLength = (n : number ) => (s : string ) => s .length >= n
298
+ const maxLength = (n : number ) => (s : string ) => s .length <= n
299
+
300
+ const length = (n : number ) => Predicate .and (minLength (n ), maxLength (n ))
301
+
302
+ assert .deepStrictEqual (length (2 )(" aa" ), true )
303
+ assert .deepStrictEqual (length (2 )(" a" ), false )
304
+ assert .deepStrictEqual (length (2 )(" aaa" ), false )
305
+ ```
230
306
231
307
``` ts
232
308
import { Predicate } from " effect"
@@ -244,3 +320,7 @@ assert.deepStrictEqual(length(2)("aaa"), false)
244
320
### Since
245
321
246
322
2.0.0
323
+
324
+ ### Since
325
+
326
+ 2.0.0
0 commit comments