@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 1.51 kB
JavaScript
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import r from"./define-nonenumerable-read-only-property.js";import e from"./../assert/is-object-like.js";import i from"./../assert/is-string.js";import t from"./../assert/is-array.js";import n from"./copy.js";import o from"./../assert/is-plain-object.js";import s from"./../assert/has-own-property.js";var a=i.isPrimitive,p=o,m=s;function u(r,e){return p(e)?m(e,"sep")&&(r.sep=e.sep,!a(r.sep))?new TypeError("invalid option. `sep` option must be a string primitive. Option: `"+r.sep+"`."):null:new TypeError("invalid argument. Options argument must be an object. Value: `"+e+"`.")}var f=".",l={sep:f},v=e,y=s;function g(r,e){var i,t=e.length,n=r;for(i=0;i<t;i++){if(!v(n)||!y(n,e[i]))return;n=n[e[i]]}return n}var c=e,h=i.isPrimitive,j=t,w=n,b=u,d=l,E=g;function T(r,e,i){var t,n,o,s;if(c(r)){if(!(t=h(e))&&!j(e))throw new TypeError("invalid argument. Key path must be a string primitive or a key array. Value: `"+e+"`.");if(o=w(d),arguments.length>2&&(s=b(o,i)))throw s;return n=t?e.split(o.sep):e,E(r,n)}}var k=i.isPrimitive,P=t,V=e,K=n,O=u,x=l,q=g;function z(r,e){var i,t,n,o;if(!(i=k(r))&&!P(r))throw new TypeError("invalid argument. Key path must be a string primitive or a key array. Value: `"+r+"`.");if(n=K(x),arguments.length>1&&(o=O(n,e)))throw o;return t=i?r.split(n.sep):r,s;function s(r){if(V(r))return q(r,t)}}var A=r,B=T,C=z;A(B,"factory",C);export default B;
//# sourceMappingURL=deep-get.js.map