Skip to content

Commit

Permalink
temporary create (Array/String)#contains methods
Browse files Browse the repository at this point in the history
  • Loading branch information
termi committed Dec 5, 2014
1 parent 289b16b commit 4e22924
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions es6-transpiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

require("es5-shim");
require("es6-shim");
polifills();

var MIXIN = function(t,s) {
for(var p in s) {
Expand Down Expand Up @@ -316,3 +317,17 @@ function outputToConsole(output, config) {
}
process.exit(0);
}

function polifills() {
if ( !Array.prototype.contains ) {
Array.prototype.contains = function(from) {

This comment has been minimized.

Copy link
@sebmck

sebmck Jan 13, 2015

These are enumerable so for...in loops will iterate over these.

This comment has been minimized.

Copy link
@mathiasbynens

mathiasbynens Jan 15, 2015

These have been renamed from contains to includes.

return !!~this.indexOf(from);
}
}

if ( !String.prototype.contains ) {
String.prototype.contains = function(from) {
return !!~this.indexOf(from);
}
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "es6-transpiler",
"version": "0.7.17",
"version": "0.7.18",
"description": "es6 -> es5",
"main": "./build/es5/es6-transpiler.js",
"bin": "./build/es5/es6toes5",
Expand Down

0 comments on commit 4e22924

Please sign in to comment.