ynn-http-assert
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "ynn-http-assert", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A more powerful http assertion library.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -5,2 +5,3 @@ const deepEqual = require( 'deep-equal' ); | ||
const types = require( './types' ); | ||
const indexOf = require( './indexof' ); | ||
@@ -33,2 +34,3 @@ const VALUE = Symbol( 'value' ); | ||
this.async = false; | ||
this.setDefault = false; | ||
} | ||
@@ -38,2 +40,3 @@ | ||
this.defaultValue = value; | ||
this.setDefault = true; | ||
if( !this.value() ) { | ||
@@ -47,3 +50,6 @@ this.value( value ); | ||
value( v ) { | ||
if( v ) { | ||
/** | ||
* the default value can be an undefined | ||
*/ | ||
if( arguments.length ) { | ||
this[ VALUE ] = v; | ||
@@ -107,2 +113,6 @@ return this; | ||
in( haystack, ...args ) { | ||
return this.assert( indexOf( haystack, this.value() ) !== -1, ...args ); | ||
} | ||
length( interval, ...args ) { | ||
@@ -176,3 +186,3 @@ const v = this.value(); | ||
if( this.skip || value ) return this; | ||
if( this.defaultValue ) { | ||
if( this.setDefault ) { | ||
this.value( this.defaultValue ); | ||
@@ -179,0 +189,0 @@ this.skip = true; |
65877
16
622