From 57efce4ac5e9659093d1197467b36a0109f1ff2f Mon Sep 17 00:00:00 2001 From: Nicholas Yang Date: Tue, 7 May 2019 18:55:58 -0400 Subject: [PATCH] Modified __rest to check if property is enumerable. (#66) * Modified __rest to check if property is enumerable, as according to my TypeScript PR * Changed propertyIsEnumerable call to be on s and not on Object. --- 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..6a9aced 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.call(s, p[i])) + t[p[i]] = s[p[i]]; + } return t; } diff --git a/tslib.js b/tslib.js index b0b1ff3..639fbcd 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.call(s, p[i])) + t[p[i]] = s[p[i]]; + } return t; };