check-types-mini
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -7,2 +7,6 @@ # Change Log | ||
## [1.2.0] - 2017-05-15 | ||
### Added | ||
- opts.ignoreKeys won't throw now if input is a single string. | ||
## [1.1.0] - 2017-05-15 | ||
@@ -9,0 +13,0 @@ ### Added |
@@ -36,2 +36,9 @@ 'use strict' | ||
opts = objectAssign(clone(defaults), opts) | ||
if (typeof opts.ignoreKeys === 'string') { | ||
if (opts.ignoreKeys.length > 0) { | ||
opts.ignoreKeys = [opts.ignoreKeys] | ||
} else { | ||
opts.ignoreKeys = [] | ||
} | ||
} | ||
if (!isArr(opts.ignoreKeys)) { | ||
@@ -38,0 +45,0 @@ throw new TypeError('check-types-mini/checkTypes(): [THROW_ID_03] opts.ignoreKeys should be an array, currently it\'s: ' + type(opts.ignoreKeys)) |
{ | ||
"name": "check-types-mini", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Check the types of your options object's values after user has customised them", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -63,3 +63,3 @@ # check-types-mini | ||
{ | | | | | ||
`ignoreKeys` | Array | no | `[]` (empty array) | Instructs to skip all and any checks on keys, specified in this array. Put them as strings. | ||
`ignoreKeys` | Array or String | no | `[]` (empty array) | Instructs to skip all and any checks on keys, specified in this array. Put them as strings. | ||
} | | | | | ||
@@ -66,0 +66,0 @@ |
@@ -126,2 +126,8 @@ 'use strict' | ||
}, 'check-types-mini/checkTypes(): [THROW_ID_03] opts.ignoreKeys should be an array, currently it\'s: boolean') | ||
t.notThrows(function () { | ||
checkTypes({a: 'a'}, {a: 'b'}, 'aa', 'bbb', { ignoreKeys: 'a' }) | ||
}) | ||
t.notThrows(function () { | ||
checkTypes({a: 'a'}, {a: 'b'}, 'aa', 'bbb', { ignoreKeys: '' }) | ||
}) | ||
}) |
15812
173