UNPKG

@stdlib/esm

Version:

ES module distribution for Stdlib, a standard library for JavaScript and Node.js.

3 lines 1.6 kB
// This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 import r from"./../assert/is-object-like.js";import t from"./../assert/is-function.js";import n from"./../assert/is-plain-object.js";import e from"./../assert/has-own-property.js";import s from"./index-of.js";var i=n,o=e,u=s,a=["values","keys","*"];function l(r,t){return i(t)?(o(t,"thisArg")&&(r.thisArg=t.thisArg),o(t,"returns")&&(r.returns=t.returns,-1===u(a,r.returns))?new TypeError('invalid option. `returns` option must be one of the following: "'+a.join('", "')+'". Option: `'+r.returns+"`."):null):new TypeError("invalid argument. Options must be an object. Value: `"+t+"`.")}function f(r,t,n){var e,s,i,o,u;for(i in e=t.thisArg,s=[[],[]],o=!0,r)o=!1,u=r[i],n.call(e,u,i)?s[0].push(u):s[1].push(u);return o&&(s.length=0),s}function p(r,t,n){var e,s,i,o;for(i in e=t.thisArg,s=[[],[]],o=!0,r)o=!1,n.call(e,r[i],i)?s[0].push(i):s[1].push(i);return o&&(s.length=0),s}function h(r,t,n){var e,s,i,o,u;for(i in e=t.thisArg,s=[[],[]],o=!0,r)o=!1,u=r[i],n.call(e,u,i)?s[0].push([i,u]):s[1].push([i,u]);return o&&(s.length=0),s}var m=r,g=t,c=l,v=f,j=p,w=h;function b(r,t,n){var e,s,i;if(!m(r))throw new TypeError("invalid argument. First argument must be an object. Value: `"+r+"`.");if(e={returns:"values"},2===arguments.length)i=t;else{if(s=c(e,t))throw s;i=n}if(!g(i))throw new TypeError("invalid argument. Last argument must be a function. Value: `"+i+"`.");return"values"===e.returns?v(r,e,i):"keys"===e.returns?j(r,e,i):w(r,e,i)}var y=b;export default y; //# sourceMappingURL=bifurcate-in.js.map