decentralized-internet
Version:
An NPM library of programs to create decentralized web and distributed computing projects
1 lines • 540 B
JavaScript
;const Any=require("./any"),Hoek=require("hoek"),internals={};internals.Lazy=class extends Any{constructor(){super(),this._type="lazy"}_base(e,r,s){const t={value:e},n=this._flags.lazy;if(!n)return t.errors=this.createError("lazy.base",null,r,s),t;const a=n();return a instanceof Any?a._validate(e,r,s):(t.errors=this.createError("lazy.schema",null,r,s),t)}set(e){Hoek.assert("function"==typeof e,"You must provide a function as first argument");const r=this.clone();return r._flags.lazy=e,r}},module.exports=new internals.Lazy;