Compare commits

..

No commits in common. "a7a20f55f442284748164342d58df1c7abc9fc21" and "a0cc29169d5a7ae6f8d79f9fa2f726f00e096e41" have entirely different histories.

4 changed files with 4 additions and 15 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "@dzeio/schema", "name": "@dzeio/schema",
"version": "0.1.0", "version": "0.0.6",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@dzeio/schema", "name": "@dzeio/schema",
"version": "0.1.0", "version": "0.0.6",
"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",

View File

@ -1,6 +1,6 @@
{ {
"name": "@dzeio/schema", "name": "@dzeio/schema",
"version": "0.1.0", "version": "0.0.6",
"dependencies": { "dependencies": {
"@dzeio/object-util": "^1.8.3" "@dzeio/object-util": "^1.8.3"
}, },

View File

@ -83,17 +83,6 @@ export default abstract class SchemaItem<Type = any> implements StandardSchemaV1
return this return this
} }
/**
* make sure the value is one of the `values`
* @param values the values the item MUST contains
*/
@parceable()
public in(...values: Array<Type>): this {
this.addValidation((input) => values.includes(input))
return this
}
public attrs(...attributes: Array<string>) { public attrs(...attributes: Array<string>) {
this.attributes.concat(attributes) this.attributes.concat(attributes)
return this return this

View File

@ -18,7 +18,7 @@ export default class SchemaEnum<E extends EnumLike> extends SchemaItem<E[keyof E
this.type = 'number' this.type = 'number'
} }
// test above === number // test above === numebr
this.validations.push({ this.validations.push({
fn: (input) => Object.values(this.templateEnum).includes(input), fn: (input) => Object.values(this.templateEnum).includes(input),
error: `Input is not part of ${templateEnum.constructor.name}` error: `Input is not part of ${templateEnum.constructor.name}`