From 615ca28cde8f9b697f41a9cf2ca6f4231d9e16cd Mon Sep 17 00:00:00 2001 From: Trollhunters501 <91704943+Trollhunters501@users.noreply.github.com> Date: Fri, 3 Nov 2023 12:12:23 -0600 Subject: [PATCH] Update NewPolifills.js New Polyfills Update! --- libs/NewPolifills.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/libs/NewPolifills.js b/libs/NewPolifills.js index 320c6fe..541fde4 100644 --- a/libs/NewPolifills.js +++ b/libs/NewPolifills.js @@ -48,7 +48,7 @@ Object.assign = function (t) { } return t; }; Object.entries = function( obj ){ - var ownProps = Object.keys( obj ), i = ownProps.length, resArray = new Array(i); + let ownProps = Object.keys( obj ), i = ownProps.length, resArray = new Array(i); while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]]; return resArray; }; @@ -79,3 +79,28 @@ Object.defineProperty(String.prototype, "padEnd", { return this+padString.repeat(targetLength-this.length); } }); +Object.defineProperty(Array.prototype, 'flatMap', { + value: function (lambda) { + return [].concat.apply([],this.map(lambda)); + } +}); +Object.is = function(x,y) { + if (x === y) { + return x !== 0 || 1 / x === 1 / y; + } + return x !== x && y !== y; + } +Object.values=function(obj) { + let ary=[]; + for (var key in obj){ + ary.push(obj[key]); + } + return ary; + } +Object.getOwnPropertyDescriptors=function(obj){ + let ret={}; + for(var key in obj){ + ret[key]=Object.getOwnPropertyDescriptor(obj,key); + } + return ret; + }