mirror of https://github.com/lukechilds/ow.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
550 B
27 lines
550 B
import {Predicate, Context} from './predicate';
|
|
|
|
export class BooleanPredicate extends Predicate<boolean> {
|
|
constructor(context?: Context) {
|
|
super('boolean', context);
|
|
}
|
|
|
|
/**
|
|
* Test a boolean to be true.
|
|
*/
|
|
get true() {
|
|
return this.addValidator({
|
|
message: value => `Expected ${value} to be true`,
|
|
validator: value => value === true
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Test a boolean to be false.
|
|
*/
|
|
get false() {
|
|
return this.addValidator({
|
|
message: value => `Expected ${value} to be false`,
|
|
validator: value => value === false
|
|
});
|
|
}
|
|
}
|
|
|