diff --git a/src/bowser.js b/src/bowser.js index 59f1666..81d1c6c 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -418,6 +418,23 @@ return version.split(".").length; } + /** + * Array::map polyfill + * @param {Array} arr + * @param {Function} iterator + * @return {Array} + */ + function map(arr, iterator) { + var result = [], i; + if (Array.prototype.map) { + return Array.prototype.map.call(arr, iterator); + } + for (i = 0; i < arr.length; i++) { + result = iterator(arr[i]); + } + return result; + } + /** * Calculate browser version weight * @see http://jsbin.com/vohahaciku/1/edit?js,console