Compare commits
2 Commits
ede2283f68
...
35e67bd63a
Author | SHA1 | Date | |
---|---|---|---|
35e67bd63a | |||
685fd29957 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@dzeio/schema",
|
"name": "@dzeio/schema",
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@dzeio/schema",
|
"name": "@dzeio/schema",
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dzeio/object-util": "^1.8.3",
|
"@dzeio/object-util": "^1.8.3",
|
||||||
"@standard-schema/spec": "^1.0.0",
|
"@standard-schema/spec": "^1.0.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dzeio/schema",
|
"name": "@dzeio/schema",
|
||||||
"version": "0.0.4",
|
"version": "0.0.5",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dzeio/object-util": "^1.8.3"
|
"@dzeio/object-util": "^1.8.3"
|
||||||
},
|
},
|
||||||
|
@ -18,11 +18,6 @@ import { SchemaJSON } from './types'
|
|||||||
export function parceable() {
|
export function parceable() {
|
||||||
|
|
||||||
return (target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => {
|
return (target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => {
|
||||||
// make sure the target is of SchemaItem
|
|
||||||
if (!(target instanceof SchemaItem)) {
|
|
||||||
throw new Error('the decorator is only usable on Schema')
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sur the property exists in the target
|
// make sur the property exists in the target
|
||||||
if (!(propertyKey in target)) {
|
if (!(propertyKey in target)) {
|
||||||
throw new Error('property not set in object')
|
throw new Error('property not set in object')
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
/* eslint-disable id-length */
|
/* eslint-disable id-length */
|
||||||
import { objectClean } from '@dzeio/object-util'
|
import { objectClean } from '@dzeio/object-util'
|
||||||
import { StandardSchemaV1 } from '@standard-schema/spec'
|
import { StandardSchemaV1 } from '@standard-schema/spec'
|
||||||
import SchemaNullable from 'items/nullable'
|
import Schema, { isNull, parceable, SchemaNullable } from './Schema'
|
||||||
import { isNull } from './helpers'
|
|
||||||
import Schema, { parceable } from './Schema'
|
|
||||||
import { SchemaJSON, ValidationError, ValidationResult } from './types'
|
import { SchemaJSON, ValidationError, ValidationResult } from './types'
|
||||||
export default abstract class SchemaItem<Type = any> implements StandardSchemaV1<Type> {
|
export default abstract class SchemaItem<Type = any> implements StandardSchemaV1<Type> {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user