Skip to content

Commit

Permalink
Update NewPolifills.js
Browse files Browse the repository at this point in the history
New polyfills
  • Loading branch information
Trollhunters501 authored Nov 3, 2023
1 parent 371cff2 commit 6cfd50a
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions libs/NewPolifills.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,30 @@ Object.entries = function( obj ){
while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]];
return resArray;
};
Object.defineProperty(String.prototype, "", {
value: function(){

Object.defineProperty(String.prototype, "includes", {
value: function(searchString, position){
if (position==null)position=0;
if (this.indexOf(searchString,position)>-1){
return true;
}else{
return false;
}
}
});
Object.defineProperty(String.prototype, "include", {
value: function(searchString, position){
return this.includes(searchString, position);
}
});
Object.defineProperty(String.prototype, "padStart", {
value: function(targetLength, padString){
if (padString==null)padString=" ";
return padString.repeat(targetLength-this.length)+this;
}
});
Object.defineProperty(String.prototype, "padEnd", {
value: function(targetLength, padString){
if (padString==null)padString=" ";
return this+padString.repeat(targetLength-this.length);
}
});

0 comments on commit 6cfd50a

Please sign in to comment.