Skip to content

Commit 57efce4

Browse files
NicholasLYangrbuckton
authored andcommitted
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.
1 parent ca03390 commit 57efce4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

tslib.es6.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ export function __rest(s, e) {
4343
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4444
t[p] = s[p];
4545
if (s != null && typeof Object.getOwnPropertySymbols === "function")
46-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
47-
t[p[i]] = s[p[i]];
46+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
47+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
48+
t[p[i]] = s[p[i]];
49+
}
4850
return t;
4951
}
5052

tslib.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ var __importDefault;
7979
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
8080
t[p] = s[p];
8181
if (s != null && typeof Object.getOwnPropertySymbols === "function")
82-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
83-
t[p[i]] = s[p[i]];
82+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
83+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
84+
t[p[i]] = s[p[i]];
85+
}
8486
return t;
8587
};
8688

0 commit comments

Comments
 (0)