@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 1.63 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"./../assert/is-collection.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 i from"./index-of.js";var s=n,o=e,u=i,a=["values","indices","*"];function l(r,t){return s(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,i,s,o,u;if(e=t.thisArg,0===(s=r.length))return[];for(i=[[],[]],u=0;u<s;u++)o=r[u],n.call(e,o,u)?i[0].push(o):i[1].push(o);return i}function p(r,t,n){var e,i,s,o;if(e=t.thisArg,0===(s=r.length))return[];for(i=[[],[]],o=0;o<s;o++)n.call(e,r[o],o)?i[0].push(o):i[1].push(o);return i}function h(r,t,n){var e,i,s,o,u;if(e=t.thisArg,0===(s=r.length))return[];for(i=[[],[]],u=0;u<s;u++)o=r[u],n.call(e,o,u)?i[0].push([u,o]):i[1].push([u,o]);return i}var m=r,c=t,g=l,v=f,w=p,d=h;function j(r,t,n){var e,i,s;if(!m(r))throw new TypeError("invalid argument. First argument must be a collection. Value: `"+r+"`.");if(e={returns:"values"},2===arguments.length)s=t;else{if(i=g(e,t))throw i;s=n}if(!c(s))throw new TypeError("invalid argument. Last argument must be a function. Value: `"+s+"`.");return"values"===e.returns?v(r,e,s):"indices"===e.returns?w(r,e,s):d(r,e,s)}var b=j;export default b;
//# sourceMappingURL=bifurcate-by.js.map