@stdlib/esm
Version:
ES module distribution for Stdlib, a standard library for JavaScript and Node.js.
3 lines • 2.28 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-string.js";import e from"./../assert/is-nonnegative-integer.js";import t from"./../assert/is-collection.js";import a from"./../assert/is-arraybuffer.js";import i from"./../assert/is-object.js";import o from"./../assert/is-function.js";import n from"./../assert/has-own-property.js";import s from"./ctors.js";import l from"./../blas/ext/base/gfill.js";import p from"./../assert/has-iterator-symbol-support.js";import m from"./../symbol/iterator.js";var f=r.isPrimitive,u=e.isPrimitive,y=t,g=a,d=i,v=o,h=n,w=s,j=l,b=p,c=m,E=b();function k(){var r,e,t,a,i,o,n,s,l;if(e=arguments.length,(e-=1)>=0&&f(arguments[e])?(t=arguments[e],e-=1):t="float64",null===(a=w(t)))throw new TypeError("invalid argument. Must provide a recognized data type. Value: `"+t+"`.");if("generic"===t){if(e<=0)return[];if(r=arguments[0],n=arguments[1],1===e){if(u(n)?o=n:y(n)&&(o=n.length),void 0!==o){for(i=[],l=0;l<o;l++)i.push(r);return i}if(g(n))throw new Error("invalid arguments. Creating a generic array from an ArrayBuffer is not supported.");if(d(n)){if(!1===E)throw new TypeError("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, typed array, or array-like object. Value: `"+n+"`.");if(!v(n[c]))throw new TypeError("invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `"+n+"`.");if(n=n[c](),!v(n.next))throw new TypeError("invalid argument. Must provide a length, typed array, array-like object, or an iterable.");for(i=[];s=n.next(),h(s,"value")&&i.push(r),!s.done;);return i}throw new TypeError("invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `"+n+"`.")}if(g(n))throw new Error("invalid arguments. Creating a generic array from an ArrayBuffer is not supported.");throw new TypeError("invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `"+n+"`.")}return e<=0?new a(0):(i=1===e?new a(arguments[1]):2===e?new a(arguments[1],arguments[2]):new a(arguments[1],arguments[2],arguments[3]),r=arguments[0],i.length>0&&0!==r&&j(i.length,r,i,1),i)}var M=k;export default M;
//# sourceMappingURL=filled.js.map