validate-value
Advanced tools
Comparing version 8.1.1 to 8.2.0
import { isOfType } from './isOfType'; | ||
import { Value } from './Value'; | ||
export { isOfType, Value }; | ||
import { values } from './values'; | ||
export { isOfType, Value, values }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Value = exports.isOfType = void 0; | ||
exports.values = exports.Value = exports.isOfType = void 0; | ||
const isOfType_1 = require("./isOfType"); | ||
@@ -8,1 +8,3 @@ Object.defineProperty(exports, "isOfType", { enumerable: true, get: function () { return isOfType_1.isOfType; } }); | ||
Object.defineProperty(exports, "Value", { enumerable: true, get: function () { return Value_1.Value; } }); | ||
const values_1 = require("./values"); | ||
Object.defineProperty(exports, "values", { enumerable: true, get: function () { return values_1.values; } }); |
@@ -0,1 +1,8 @@ | ||
# [8.2.0](https://github.com/thenativeweb/validate-value/compare/8.1.1...8.2.0) (2020-11-12) | ||
### Features | ||
* Add constant typesafe tokens ([#210](https://github.com/thenativeweb/validate-value/issues/210)) ([db747b7](https://github.com/thenativeweb/validate-value/commit/db747b79e75767ee609c3572a25749c009bafb60)) | ||
## [8.1.1](https://github.com/thenativeweb/validate-value/compare/8.1.0...8.1.1) (2020-11-03) | ||
@@ -2,0 +9,0 @@ |
import { isOfType } from './isOfType'; | ||
import { Value } from './Value'; | ||
import { values } from './values'; | ||
export { isOfType, Value }; | ||
export { isOfType, Value, values }; |
{ | ||
"name": "validate-value", | ||
"version": "8.1.1", | ||
"version": "8.2.0", | ||
"description": "validate-value validates values against JSON schemas.", | ||
@@ -17,2 +17,6 @@ "contributors": [ | ||
"email": "hannes.leutloff@thenativeweb.io" | ||
}, | ||
{ | ||
"name": "Alexander Kampf", | ||
"email": "alexander.kampf@thenativeweb.io" | ||
} | ||
@@ -27,5 +31,5 @@ ], | ||
"devDependencies": { | ||
"assertthat": "5.2.1", | ||
"roboter": "11.5.1", | ||
"semantic-release-configuration": "1.0.24" | ||
"assertthat": "5.2.5", | ||
"roboter": "11.5.7", | ||
"semantic-release-configuration": "1.0.25" | ||
}, | ||
@@ -32,0 +36,0 @@ "repository": { |
@@ -96,2 +96,4 @@ # validate-value | ||
```javascript | ||
const { isTypeOf } = require('validate-value'); | ||
const user = { | ||
@@ -117,5 +119,7 @@ username: 'Jane Doe', | ||
When using TypeScript, you may even specify a generic type parameter, and use the function as a type guard: | ||
When using TypeScript, you may even specify a generic type parameter, and use the function as a type guard. Also it is recommended to use the constant values exported by validate-value instead of the string literals as above, as they are the type-safe versions of these literals: | ||
```typescript | ||
import { isTypeOf, value as v } | ||
interface User { | ||
@@ -132,6 +136,6 @@ username: string; | ||
const schema = { | ||
type: 'object', | ||
type: v.object, | ||
properties: { | ||
username: { type: 'string' }, | ||
password: { type: 'string' } | ||
username: { type: v.string }, | ||
password: { type: v.string } | ||
}, | ||
@@ -138,0 +142,0 @@ additionalProperties: false, |
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
17124
22
237
155