Switching from Array.prototype.AllValuesSame to function AllValuesSame to avoid clashes with other modules
diff --git a/utilities/index.js b/utilities/index.js
index 66cb2e1..cdd78b7 100755
--- a/utilities/index.js
+++ b/utilities/index.js
@@ -1,9 +1,9 @@
var _ = require("underscore");
-Array.prototype.AllValuesSame = function(){
- if (this.length > 0) {
- for (var i = 1; i < this.length; i++){
- if (this[i] !== this[0]){
+var AllValuesSame = function( arr ){
+ if (arr.length > 0) {
+ for (var i = 1; i < arr.length; i++){
+ if (arr[i] !== arr[0]){
return false;
}
}
@@ -65,7 +65,7 @@
gains.push(Gain(data, features[i], y, num_tries));
}
- if (_.pluck(gains, 'gain').AllValuesSame){
+ if ( AllValuesSame(_.pluck(gains, 'gain')) ){
return gains[RandomInt(0, gains.length)];
} else {
return _.max(gains,function(e){
@@ -350,4 +350,5 @@
module.exports.GetType = GetType;
module.exports.GetDominate = GetDominate;
module.exports.Average = Average;
-module.exports.d3ifyModel = d3ifyModel;
\ No newline at end of file
+module.exports.d3ifyModel = d3ifyModel;
+module.exports.AllValuesSame = AllValuesSame;
\ No newline at end of file