You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Object.entries/values include non-enumerable defineProperty slots (Object.keys is correct) #5046
consto: any={};Object.defineProperty(o,'hidden',{value: 1});// enumerable defaults to falseo.shown=2;console.log(JSON.stringify(Object.entries(o)),JSON.stringify(Object.keys(o)));
Actual (Perry)
[["hidden",1],["shown",2]] ["shown"]
Expected (Node)
[["shown",2]] ["shown"]
Object.keys filters non-enumerable properties correctly; Object.entries (and presumably Object.values) does not. Real-world sighting: chalk's vendored ansi-styles assembles its style object with several non-enumerable defineProperty slots (codes, rgbToAnsi256, hexToRgb, …) — Object.entries(ansiStyles) returns 55 entries under Perry vs Node's 45, so chalk defines 10 extra (unused) style getters. Harmless there, but any code branching on entries/values length or content over such objects diverges.
Activity
fix(object): Object.entries/values skip non-enumerable descriptor slo…