object-keys
An Object.keys shim. Invoke its "shim" method to shim Object.keys if it is unavailable.
Most common usage:
var keys = Objectkeys || ;
Example
var keys = ;var assert = ;var obj = a: true b: true c: true; assert;
var keys = ;var assert = ;/* when Object.keys is not present */delete Objectkeys;var shimmedKeys = keys;assert;assert;
var keys = ;var assert = ;/* when Object.keys is present */var shimmedKeys = keys;assert;assert;
Source
Implementation taken directly from es5-shim, with modifications, including from lodash.
Tests
Simply clone the repo, npm install
, and run npm test