いい感じに

This commit is contained in:
syuilo 2017-03-03 10:31:59 +09:00
parent e0c44abd4a
commit 73ac13a274

View file

@ -31,10 +31,10 @@
/** /**
* null undefined * null undefined
* *
* nullまたはundefined * null undefined
* *
* *
* nullとundefinedを次のように区別していま: * null undefined :
* null ... * null ...
* undefined ... * undefined ...
* *
@ -47,9 +47,9 @@
* undefined null * undefined null
* undefined null * undefined null
* *
* .require() * null null
* () .notUndefined() * null nullable :
* .notNull() 使 * const [val, err] = it(x).must.be.a.nullable.string().required().qed();
*/ */
import * as mongo from 'mongodb'; import * as mongo from 'mongodb';
@ -104,35 +104,15 @@ class QueryCore implements Query {
} }
/** /**
* * (=undefined)
*/ */
required() { required() {
if (this.error === null && this.isEmpty) {
this.error = new Error('required');
}
return this;
}
/**
* (=undefined)
*/
notUndefined() {
if (this.error === null && this.isUndefined) { if (this.error === null && this.isUndefined) {
this.error = new Error('required'); this.error = new Error('required');
} }
return this; return this;
} }
/**
* null
*/
notNull() {
if (this.error === null && this.isNull) {
this.error = new Error('required');
}
return this;
}
/** /**
* (=undefined) * (=undefined)
*/ */