Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

@anzenjs/joi

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anzenjs/joi - npm Package Compare versions

Comparing version 0.0.4-alpha.0 to 0.0.4-alpha.1

@@ -22,15 +22,15 @@ "use strict";

switch (schema) {
case extra_1.emailSchema:
case extra_1.Email:
return joi_1.default.string().email();
case extra_1.uriSchema:
case extra_1.Uri:
return joi_1.default.string().uri();
case extra_1.integerSchema:
case extra_1.Integer:
return joi_1.default.number().integer();
case extra_1.portSchema:
case extra_1.Port:
return joi_1.default.number().port();
case extra_1.ipSchema:
case extra_1.Ip:
return joi_1.default.string().ip();
case extra_1.hostnameSchema:
case extra_1.Hostname:
return joi_1.default.string().hostname();
case extra_1.uuidSchema:
case extra_1.Uuid:
return joi_1.default.string().guid();

@@ -37,0 +37,0 @@ default:

{
"name": "@anzenjs/joi",
"version": "0.0.4-alpha.0",
"version": "0.0.4-alpha.1",
"main": "cjs/src/index.js",

@@ -18,6 +18,6 @@ "types": "cjs/src/index.d.ts",

"@anzenjs/core": "^0.0.3",
"@anzenjs/extra": "^0.0.4-alpha.0",
"@anzenjs/extra": "^0.0.4-alpha.1",
"joi": "^14.3.1"
},
"gitHead": "0f9659432114ef764fc951c1c1326f8e6c6da99f"
"gitHead": "5022259a40c0508dae37df5404853765c18200dd"
}

@@ -7,2 +7,3 @@ import {

Schema,
SchemaLike,
SchemaType,

@@ -149,5 +150,5 @@ } from '@anzenjs/core'

public decode(schema: Schema) {
public decode(schema: SchemaLike) {
return (value: unknown): any => {
const result = this.resolveJoiSchema(schema).validate(
const result = this.resolveJoiSchema(resolveSchema(schema)).validate(
value,

@@ -154,0 +155,0 @@ this.options.validationOptions,

@@ -1,10 +0,2 @@

import {
emailSchema,
hostnameSchema,
integerSchema,
ipSchema,
portSchema,
uriSchema,
uuidSchema,
} from '@anzenjs/extra'
import { Email, Hostname, Integer, Ip, Port, Uri, Uuid } from '@anzenjs/extra'
import Joi, { ArraySchema } from 'joi'

@@ -27,15 +19,15 @@ import { SchemaResolver } from './decoder'

switch (schema) {
case emailSchema:
case Email:
return Joi.string().email()
case uriSchema:
case Uri:
return Joi.string().uri()
case integerSchema:
case Integer:
return Joi.number().integer()
case portSchema:
case Port:
return Joi.number().port()
case ipSchema:
case Ip:
return Joi.string().ip()
case hostnameSchema:
case Hostname:
return Joi.string().hostname()
case uuidSchema:
case Uuid:
return Joi.string().guid()

@@ -42,0 +34,0 @@ default:

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet