Skip to content

Commit

Permalink
Move polyfills to beginning of battle-dex.ts
Browse files Browse the repository at this point in the history
The polyfills are used immediately, so moving it elsewhere isn't an
option.
  • Loading branch information
Zarel committed May 20, 2018
1 parent 955fc7e commit 5649740
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 deletions.
47 changes: 0 additions & 47 deletions src/battle-dex-misc.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions src/battle-dex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,53 @@
* @license MIT
*/

if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (searchElement, fromIndex) {
for (var i = (fromIndex || 0); i < this.length; i++) {
if (this[i] === searchElement) return i;
}
return -1;
};
}
if (!Array.prototype.includes) {
Array.prototype.includes = function (thing) {
return this.indexOf(thing) !== -1;
};
}
if (!String.prototype.includes) {
String.prototype.includes = function (thing) {
return this.indexOf(thing) !== -1;
};
}
if (!String.prototype.startsWith) {
String.prototype.startsWith = function (thing) {
return this.slice(0, thing.length) === thing;
};
}
if (!String.prototype.endsWith) {
String.prototype.endsWith = function (thing) {
return this.slice(-thing.length) === thing;
};
}
if (!Object.assign) {
Object.assign = function (thing, rest) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var k in source) {
thing[k] = source[k];
}
}
return thing;
};
}
// if (!Object.create) {
// Object.create = function (proto) {
// function F() {}
// F.prototype = proto;
// return new F();
// };
// }

if (!window.exports) window.exports = window;

if (window.soundManager) {
Expand Down

0 comments on commit 5649740

Please sign in to comment.