UNPKG

decentralized-internet

Version:

An NPM library of programs to create decentralized web and distributed computing projects

1 lines 561 B
"use strict";const Hoek=require("@hapi/hoek"),Ref=require("./ref"),internals={};exports.schema=function(e,t){return null!=t&&"object"==typeof t?t.isJoi?t:Array.isArray(t)?e.alternatives().try(t):t instanceof RegExp?e.string().regex(t):t instanceof Date?e.date().valid(t):e.object().keys(t):"string"==typeof t?e.string().valid(t):"number"==typeof t?e.number().valid(t):"boolean"==typeof t?e.boolean().valid(t):Ref.isRef(t)?e.valid(t):(Hoek.assert(null===t,"Invalid schema content:",t),e.valid(null))},exports.ref=function(e){return Ref.isRef(e)?e:Ref.create(e)};