From 7a6f5a7e3c9f0b58ad536b58abe529c41aff3652 Mon Sep 17 00:00:00 2001 From: Nicholas Yang Date: Fri, 1 Feb 2019 01:09:28 -0500 Subject: [PATCH 1/2] Modified __rest to check if property is enumerable, as according to my TypeScript PR --- tslib.es6.js | 6 ++++-- tslib.js | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tslib.es6.js b/tslib.es6.js index 6da273e..523b679 100644 --- a/tslib.es6.js +++ b/tslib.es6.js @@ -43,8 +43,10 @@ export function __rest(s, e) { for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) - t[p[i]] = s[p[i]]; + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable(p[i])) + t[p[i]] = s[p[i]]; + } return t; } diff --git a/tslib.js b/tslib.js index b0b1ff3..e1339f2 100644 --- a/tslib.js +++ b/tslib.js @@ -79,8 +79,10 @@ var __importDefault; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) - t[p[i]] = s[p[i]]; + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable(p[i])) + t[p[i]] = s[p[i]]; + } return t; }; From 254087397f1cc63a8db46f56d27480b21f874c21 Mon Sep 17 00:00:00 2001 From: Nicholas Yang Date: Fri, 26 Apr 2019 02:36:32 -0400 Subject: [PATCH 2/2] Changed propertyIsEnumerable call to be on s and not on Object. --- tslib.es6.js | 2 +- tslib.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tslib.es6.js b/tslib.es6.js index 523b679..6a9aced 100644 --- a/tslib.es6.js +++ b/tslib.es6.js @@ -44,7 +44,7 @@ export function __rest(s, e) { t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable(p[i])) + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; diff --git a/tslib.js b/tslib.js index e1339f2..639fbcd 100644 --- a/tslib.js +++ b/tslib.js @@ -80,7 +80,7 @@ var __importDefault; t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { - if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable(p[i])) + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t;