paulmillr / es6-shim

ECMAScript 6 compatibility shims for legacy JS engines
http://paulmillr.com
MIT License
3.11k stars 387 forks source link

Object.keys() fails in Node.js v0.12.7 #357

Closed cristian-smocot closed 8 years ago

cristian-smocot commented 8 years ago

Object.keys() spits: TypeError: undefined is not a function Version: 0.33.0 Sample test code:

  var keys = {a:1, b:2, c:3}.keys();
mathiasbynens commented 8 years ago

This report is invalid.

It’s Object.keys, not Object.prototype.keys.

Try this:

var keys = Object.keys({a:1, b:2, c:3});
cristian-smocot commented 8 years ago

Sorry! My mistake. I realize now I read the documentation badly.

So yeah, the correct form is var keys = Object.keys({a:1, b:2, c:3});