Add usage doc

This commit is contained in:
syuilo 2017-03-03 06:11:11 +09:00
parent d6af0bb78b
commit ffac713181

View file

@ -3,6 +3,29 @@
* *
*/ */
/**
* Usage Examples
*
* const [val, err] = it(x).must.be.a.string().or('asc desc').default('desc').qed();
* xは文字列でなければならず'asc''desc''desc'
*
* const [val, err] = it(x).must.be.a.number().required().range(0, 100).qed();
* xは数値でなければならず0~100
*
* const [val, err] = it(x).must.be.an.array().unique().required().validate(x => x[0] != 'strawberry pasta').qed();
* xは配列でなければならず'strawberry pasta'
*
* ~~
* const [val, err] = it(x).must.be.a.string().required().qed();
*
* const [val, err] = it(x, 'string', true);
*
*
* ~BDD風記法~
* must.be.a(n)  expect :
* const [val, err] = it(x).expect.string().required().qed();
*/
import * as mongo from 'mongodb'; import * as mongo from 'mongodb';
import hasDuplicates from '../common/has-duplicates'; import hasDuplicates from '../common/has-duplicates';