'use strict'; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; module.exports = function array_sum(array) { // eslint-disable-line camelcase // discuss at: http://locutus.io/php/array_sum/ // original by: Kevin van Zonneveld (http://kvz.io) // bugfixed by: Nate // bugfixed by: Gilbert // improved by: David Pilia (http://www.beteck.it/) // improved by: Brett Zamir (http://brett-zamir.me) // example 1: array_sum([4, 9, 182.6]) // returns 1: 195.6 // example 2: var $total = [] // example 2: var $index = 0.1 // example 2: for (var $y = 0; $y < 12; $y++){ $total[$y] = $y + $index } // example 2: array_sum($total) // returns 2: 67.2 var key; var sum = 0; // input sanitation if ((typeof array === 'undefined' ? 'undefined' : _typeof(array)) !== 'object') { return null; } for (key in array) { if (!isNaN(parseFloat(array[key]))) { sum += parseFloat(array[key]); } } return sum; }; //# sourceMappingURL=array_sum.js.map