@fivethree/billy-core
Advanced tools
Comparing version 0.13.1 to 0.14.0
@@ -203,3 +203,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (p.options.optional && !p.value) { | ||
if (p.options.optional && (!p.value && p.value !== false)) { | ||
return p; | ||
@@ -206,0 +206,0 @@ } |
import { Validator } from "../types"; | ||
export declare const isNumber: Validator; | ||
export declare const isNumberArray: () => Validator; | ||
export declare const isBoolean: () => Validator; | ||
export declare const isNumberArray: Validator; | ||
export declare const isBoolean: Validator; | ||
export declare const isString: Validator; | ||
export declare const isStringArray: () => Validator; | ||
export declare const isStringArray: Validator; | ||
export declare const isExistingPath: Validator; | ||
export declare const isNonExistingPath: Validator; |
@@ -8,17 +8,13 @@ "use strict"; | ||
}; | ||
exports.isNumberArray = () => { | ||
const validator = { | ||
validate: (mapped) => mapped.filter(p => exports.isNumber.validate(p)).length === 0, | ||
mapBefore: (list) => list.replace(', ', ',').split(','), | ||
invalidText: () => `Please specify a comma separated list of numbers.` | ||
}; | ||
return validator; | ||
exports.isNumberArray = { | ||
validate: (mapped) => mapped.filter(p => exports.isNumber.validate(p)).length === 0, | ||
mapBefore: (list) => list.replace(', ', ',').split(','), | ||
invalidText: () => `Please specify a comma separated list of numbers.` | ||
}; | ||
exports.isBoolean = () => { | ||
const validator = { | ||
validate: (mapped) => mapped, | ||
mapBefore: (value) => ['false', 'true', true, false, 'yes', 'no', 'y', 'n', '1', '0'].some(s => s === value), | ||
invalidText: () => `The parameter should be of type boolean. (Usage: [true/false , y/n, ...])` | ||
}; | ||
return validator; | ||
exports.isBoolean = { | ||
validate: (value) => ['false', 'true', true, false, 'yes', 'no', 'y', 'n', '1', '0'].some(s => s === value), | ||
mapAfter: (value) => { | ||
return ['true', true, 'yes', 'y', '1'].some(s => s === value); | ||
}, | ||
invalidText: () => `The parameter should be of type boolean. (Usage: [true/false , y/n, ...])` | ||
}; | ||
@@ -29,9 +25,6 @@ exports.isString = { | ||
}; | ||
exports.isStringArray = () => { | ||
const validator = { | ||
validate: (mapped) => mapped.filter(p => exports.isString.validate(p)).length === 0, | ||
mapBefore: (list) => list.replace(', ', ',').split(','), | ||
invalidText: () => `Please specify a comma seperated list.` | ||
}; | ||
return validator; | ||
exports.isStringArray = { | ||
validate: (mapped) => mapped.filter(p => exports.isString.validate(p)).length === 0, | ||
mapBefore: (list) => list.replace(', ', ',').split(','), | ||
invalidText: () => `Please specify a comma seperated list.` | ||
}; | ||
@@ -38,0 +31,0 @@ exports.isExistingPath = { |
{ | ||
"name": "@fivethree/billy-core", | ||
"version": "0.13.1", | ||
"version": "0.14.0", | ||
"description": "cli plugin system core.", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
57408
1269