@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 1.21 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"./keys.js";import e from"./../assert/is-array.js";import t from"./../assert/is-plain-object.js";import i from"./../assert/is-object-like.js";import o from"./../assert/is-boolean.js";import s from"./../assert/is-function.js";import a from"./../assert/has-own-property.js";var n=r,m=e,p=t,u=i,l=o.isPrimitive,f=s,j=a;function b(r,e,t){var i,o,s,a,b,c,g,v,w;if(!u(r))throw new TypeError("invalid argument. First argument must be object-like. Value: `"+r+"`.");if(i=!0,2===arguments.length)g=e;else{if(!p(e))throw new TypeError("invalid argument. Options arguments must be an object. Value: `"+e+"`.");if(j(e,"duplicates")&&(i=e.duplicates,!l(i)))throw new TypeError("invalid argument. `duplicates` option must be a boolean primitive. Option: `"+i+"`.");g=t}if(!f(g))throw new TypeError("invalid argument. Last argument must be a function. Value: `"+g+"`.");if(s=(o=n(r)).length,c={},i)for(w=0;w<s;w++)b=g(a=o[w],r[a],r),j(c,b)?(v=c[b],m(v)?c[b].push(a):c[b]=[v,a]):c[b]=a;else for(w=0;w<s;w++)c[b=g(a=o[w],r[a],r)]=a;return c}var c=b;export default c;
//# sourceMappingURL=object-inverse-by.js.map