Loading files
/*! @jscad/array-utils V3.0.4-alpha.0 (MIT) */
const coalesce=arr=>flattenHelper(arr,[]),flattenHelper=(arr,out)=>(Array.isArray(arr)?arr.forEach(child=>flattenHelper(child,out)):null!=arr&&void 0!==arr&&out.push(arr),out),flatten=arr=>arr.flat(1/0),fnNumberSort=(a,b)=>a-b,head=array=>{if(Array.isArray(array)&&0!==array.length)return array[0]},insertSorted=(array,element,compareFunction)=>{let leftbound=0,rightbound=array.length;for(;rightbound>leftbound;){const testindex=Math.floor((leftbound+rightbound)/2);compareFunction(element,array[testindex])>0?leftbound=testindex+1:rightbound=testindex}return array.splice(leftbound,0,element),array},nth=(array,index)=>{if(Array.isArray(array)&&!(array.length<index))return array[index]},padToLength=(anArray,padding,targetLength)=>{for(anArray=anArray.slice();anArray.length<targetLength;)anArray.push(padding);return anArray},toArray=array=>Array.isArray(array)?array:null==array?[]:[array];export{coalesce,flatten,fnNumberSort,head,insertSorted,nth,padToLength,toArray};
1c7200981This file is pinned to the selected release. Download the original to open it in your design tool.