Comparing version 1.0.0-beta.3 to 1.0.0-beta.4
@@ -16,2 +16,3 @@ "use strict"; | ||
isVerified: _1.validate.boolean(), | ||
verifiedAt: _1.validate.union(_1.validate.date(), _1.validate.enum('never')), | ||
joinedAt: _1.validate.date(), | ||
@@ -26,2 +27,3 @@ favoriteDishes: _1.validate.array(_1.validate.string()), | ||
isVerified: true, | ||
verifiedAt: 'never', | ||
joinedAt: new Date(), | ||
@@ -28,0 +30,0 @@ favoriteDishes: ['Pho Bo', 'Sushi'], |
@@ -8,2 +8,3 @@ export { validateArray as array } from './validate-array'; | ||
export { validateString as string } from './validate-string'; | ||
export { validateUnion as union } from './validate-union'; | ||
export declare type Validate<R> = (value: unknown) => R; |
@@ -17,2 +17,4 @@ "use strict"; | ||
exports.string = validate_string_1.validateString; | ||
var validate_union_1 = require("./validate-union"); | ||
exports.union = validate_union_1.validateUnion; | ||
//# sourceMappingURL=validate.js.map |
{ | ||
"name": "fefe", | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-beta.4", | ||
"description": "Validate, sanitize and transform values with proper types.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,3 +7,3 @@ # fefe | ||
Validate, sanitize and transform values with proper types and with zero dependencies. | ||
Validate, sanitize and transform values with proper TypeScript types and with zero dependencies. | ||
@@ -162,2 +162,6 @@ **🔎 Validation:** checks a value (example: check if value is string)<br/> | ||
### `validate.union(validator1, validator2, ...)` | ||
Returns a function `(value: unknown) => return1 | return2 | ...` that returns the return value of the first validator called with `value` that does not throw. The function throws if all validators throw. | ||
### `transform.parseBoolean()` | ||
@@ -164,0 +168,0 @@ |
@@ -16,2 +16,3 @@ import { expect } from 'chai' | ||
isVerified: validate.boolean(), | ||
verifiedAt: validate.union(validate.date(), validate.enum('never')), | ||
joinedAt: validate.date(), | ||
@@ -29,2 +30,3 @@ favoriteDishes: validate.array(validate.string()), | ||
isVerified: true, | ||
verifiedAt: 'never', | ||
joinedAt: new Date(), | ||
@@ -31,0 +33,0 @@ favoriteDishes: ['Pho Bo', 'Sushi'], |
@@ -8,3 +8,4 @@ export { validateArray as array } from './validate-array' | ||
export { validateString as string } from './validate-string' | ||
export { validateUnion as union } from './validate-union' | ||
export type Validate<R> = (value: unknown) => R |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
96123
124
1401
183