@orion-js/schema
Advanced tools
Comparing version 0.12.0 to 0.14.0
@@ -29,3 +29,23 @@ 'use strict'; | ||
if (!(0, _isString2.default)(value) && !(0, _isInteger2.default)(value)) return _Errors2.default.NOT_AN_ID; | ||
}, | ||
clean: function clean(value, _ref) { | ||
var options = _ref.options; | ||
if (!(0, _isString2.default)(value) && !(0, _isInteger2.default)(value)) return value; | ||
var trimStrings = options.trimStrings, | ||
removeEmptyStrings = options.removeEmptyStrings; | ||
value = String(value); | ||
if (trimStrings) { | ||
value = value.trim(); | ||
} | ||
if (removeEmptyStrings && value === '') { | ||
return undefined; | ||
} | ||
return value; | ||
} | ||
}); |
@@ -39,3 +39,3 @@ 'use strict'; | ||
case 0: | ||
expect(_ID2.default.validate(1234)).toBeFalsy(); | ||
expect(_ID2.default.clean(1234)).toBe('1234'); | ||
expect(_ID2.default.validate('helloworld')).toBeFalsy(); | ||
@@ -42,0 +42,0 @@ expect(_ID2.default.validate('123456')).toBeFalsy(); |
{ | ||
"name": "@orion-js/schema", | ||
"version": "0.12.0", | ||
"version": "0.14.0", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "author": "nicolaslopezj", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
190606
4874