UNPKG

@stdlib/esm

Version:

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

3 lines 1.02 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-integer.js";import e from"./../assert/is-array.js";var n=r,i=e;function t(r,e){var t,a,o,s,l,f,d;if(!i(r))throw new TypeError("invalid argument. Must provide a zipped array.");for(a=r.length,l=0;l<a;l++)if(!i(r[l]))throw new TypeError("invalid argument. Array must only contain arrays.");if(t=r[0].length,arguments.length>1){if(!i(e))throw new TypeError("invalid argument. Indices must be specified as an array.");for(l=0;l<e.length;l++){if(d=e[l],!n(d))throw new TypeError("invalid argument. All indices must be integers.");if(d<0||d>t)throw new Error("invalid argument. Must provide valid indices; i.e., an index must be on the interval [0,len], where len is the tuple length.")}t=e.length}else for(e=new Array(t),l=0;l<t;l++)e[l]=l;for(o=new Array(t),f=0;f<t;f++){for(s=new Array(a),d=e[f],l=0;l<a;l++)s[l]=r[l][d];o[f]=s}return o}var a=t;export default a; //# sourceMappingURL=unzip.js.map