metro4
Version:
The front-end framework for Build responsive, mobile-first projects on the web with the first front-end component library in Metro Style
42 lines (33 loc) • 1.14 kB
JavaScript
(function() {
'use strict';
if (typeof Array.prototype.shuffle !== "function") {
Array.prototype.shuffle = function () {
var currentIndex = this.length, temporaryValue, randomIndex;
while (0 !== currentIndex) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
temporaryValue = this[currentIndex];
this[currentIndex] = this[randomIndex];
this[randomIndex] = temporaryValue;
}
return this;
};
}
if (typeof Array.prototype.clone !== "function") {
Array.prototype.clone = function () {
return this.slice(0);
};
}
if (typeof Array.prototype.unique !== "function") {
Array.prototype.unique = function () {
var a = this.concat();
for (var i = 0; i < a.length; ++i) {
for (var j = i + 1; j < a.length; ++j) {
if (a[i] === a[j])
a.splice(j--, 1);
}
}
return a;
};
}
}());