array-reverse-polyfill
Advanced tools
Comparing version 1.0.2 to 1.0.3
13
index.js
(function() { | ||
if (navigator.userAgent.indexOf('; CPU OS 12 ') === -1) return; | ||
var ua = navigator.userAgent; | ||
if (!ua.match(/(iPhone|iPad|iPod)/)) return; | ||
var matched = ua.match(/OS ([\d_\.]+) like Mac OS X/); | ||
if (!matched[1]) return; | ||
// Match all iOS 12, because we don't know the time when Apple fixed the bug. | ||
if (matched[1].indexOf('12') !== 0) return; | ||
Array.prototype._reverse = Array.prototype.reverse; | ||
@@ -8,7 +13,7 @@ Array.prototype.reverse = function reverse() { | ||
} | ||
const nonenum = {enumerable: false}; | ||
var nonenum = {enumerable: false}; | ||
Object.defineProperties(Array.prototype, { | ||
_reverse: nonenum, | ||
reverse: nonenum, | ||
_reverse: nonenum, | ||
reverse: nonenum, | ||
}); | ||
})(); |
{ | ||
"name": "array-reverse-polyfill", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Fix IOS 12 Array Reverse Bug.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
4215
18