いい感じに

This commit is contained in:
syuilo 2017-03-03 10:31:59 +09:00
parent 6e8ee09a77
commit 8b6c7ef484

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)
*/ */