From 8452ee3ed373e29d9fa91d82d8429ebd26d01bae Mon Sep 17 00:00:00 2001 From: Sjors Provoost Date: Fri, 10 Oct 2014 11:09:40 +0200 Subject: [PATCH] Don't extend Array.prototype --- src/findpat.js | 4 +++- src/qrcode.js | 9 +-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/findpat.js b/src/findpat.js index ad1547b2..1c6a0911 100644 --- a/src/findpat.js +++ b/src/findpat.js @@ -428,7 +428,9 @@ function FinderPatternFinder() //if (Math.abs(pattern.EstimatedModuleSize - average) > 0.2 * average) if (Math.abs(pattern.EstimatedModuleSize - average) > limit) { - this.possibleCenters.remove(i); + var rest = this.slice((this.possibleCenters) + 1 || this.length); + this.length = this.possibleCenters < 0 ? this.length + this.possibleCenters : this.possibleCenters; + this.push.apply(this, rest); i--; } } diff --git a/src/qrcode.js b/src/qrcode.js index 30282675..96be2bd0 100644 --- a/src/qrcode.js +++ b/src/qrcode.js @@ -309,11 +309,4 @@ function URShift( number, bits) return number >> bits; else return (number >> bits) + (2 << ~bits); -} - - -Array.prototype.remove = function(from, to) { - var rest = this.slice((to || from) + 1 || this.length); - this.length = from < 0 ? this.length + from : from; - return this.push.apply(this, rest); -}; +} \ No newline at end of file