UNPKG

decentralized-internet

Version:

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

1 lines 612 B
"use strict";const Hoek=require("hoek"),internals={};exports.create=function(t,e){Hoek.assert("string"==typeof t,"Invalid reference key:",t);const o=Hoek.clone(e),n=function(t,e){return Hoek.reach(n.isContext?e.context:t,n.key,o)};return n.isContext=t[0]===(o&&o.contextPrefix||"$"),n.key=n.isContext?t.slice(1):t,n.path=n.key.split(o&&o.separator||"."),n.depth=n.path.length,n.root=n.path[0],n.isJoi=!0,n.toString=function(){return(n.isContext?"context:":"ref:")+n.key},n},exports.isRef=function(t){return"function"==typeof t&&t.isJoi},exports.push=function(t,e){exports.isRef(e)&&!e.isContext&&t.push(e.root)};