array-helper-functions
Version:
Lightweight Array helper methods
2 lines • 1.7 kB
JavaScript
!function(r,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.arrayHelper=n():r.arrayHelper=n()}(this,function(){return function(r){function n(t){if(e[t])return e[t].exports;var o=e[t]={i:t,l:!1,exports:{}};return r[t].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var e={};return n.m=r,n.c=e,n.d=function(r,e,t){n.o(r,e)||Object.defineProperty(r,e,{configurable:!1,enumerable:!0,get:t})},n.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(e,"a",e),e},n.o=function(r,n){return Object.prototype.hasOwnProperty.call(r,n)},n.p="",n(n.s=0)}([function(r,n,e){"use strict";var t=function(r){return"function"==typeof r},o=function r(n,e){return n.reduce(function(n,t){return Array.isArray(t)&&e?n.concat(r(t,e)):n.concat(t)},[])},i=function(r,n,e){var t=r;e&&(t=o(t,!0));for(var i=t.length;i--;)t[i]===n&&t.splice(i,1);return t},u=function(r){return r.filter(function(r){return!!r})},a=function(r,n){if(t(r))return r.apply(void 0,n);throw new Error("Error: Please pass in a function.")},c=function(r,n){if(t(r)&&Array.isArray(n))return n.every(r);throw new Error("Error: Please pass in a function.")},f=function(r){if(Array.isArray(r))return r.reduce(function(r,n,e){return r[e]=n,r},{});throw new Error("Error: Please pass in an array.")},s=function(r,n){var e=void 0;if(Array.isArray(r)&&t(n))return e=[],r.forEach(function(r){e.push(n.call(void 0,r))}),e;throw new Error("Error: Please pass in valid arguments")},p={isFunction:t,flatten:o,filter:i,compact:u,partial:a,every:c,object:f,map:s};r.exports=p}])});
//# sourceMappingURL=index.umd.min.js.map