Comparing version 3.4.0 to 3.5.0
3.5.0 / 2018-12-11 | ||
================== | ||
**features** | ||
* [[`ee3521c`](http://github.com/node-modules/parameter/commit/ee3521c74e73630b5b72014d7aeba7ed87eb865e)] - feat: support override options.widelyUndefined (#59) (Yiyu He <<dead_horse@qq.com>>) | ||
3.4.0 / 2018-10-30 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -94,3 +94,5 @@ 'use strict'; | ||
// treat null / '' / NaN as undefined | ||
if (this.widelyUndefined && (value === '' || value === null || Number.isNaN(value))) { | ||
var widelyUndefined = this.widelyUndefined; | ||
if ('widelyUndefined' in rule) widelyUndefined = rule.widelyUndefined; | ||
if (widelyUndefined && (value === '' || value === null || Number.isNaN(value))) { | ||
value = obj[key] = undefined; | ||
@@ -97,0 +99,0 @@ } |
@@ -80,3 +80,5 @@ 'use strict'; | ||
// treat null / '' / NaN as undefined | ||
if (this.widelyUndefined && | ||
let widelyUndefined = this.widelyUndefined; | ||
if ('widelyUndefined' in rule) widelyUndefined = rule.widelyUndefined; | ||
if (widelyUndefined && | ||
(value === '' || value === null || Number.isNaN(value))) { | ||
@@ -83,0 +85,0 @@ value = obj[key] = undefined; |
{ | ||
"name": "parameter", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "A parameter verify tools.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -84,2 +84,3 @@ parameter | ||
- `default` - The default value of property, once the property is allowed non-required and missed, parameter will use this as the default value. __This may change the original input params__. | ||
- `widelyUndefined` - override `options.widelyUndefined` | ||
@@ -86,0 +87,0 @@ __Note: you can combile require and type end with a notation `?` like: `int?` or `string?` to specific both type and non-required.__ |
44112
1095
253