object keys
1.0.0
Una cuña Object.keys. Invoque su método "shim" para calzar Object.keys si no está disponible.
Uso más común:
var keys = Object . keys || require ( 'object-keys' ) ;
var keys = require ( 'object-keys' ) ;
var assert = require ( 'assert' ) ;
var obj = {
a : true ,
b : true ,
c : true
} ;
assert . deepEqual ( keys ( obj ) , [ 'a' , 'b' , 'c' ] ) ;
var keys = require ( 'object-keys' ) ;
var assert = require ( 'assert' ) ;
/* when Object.keys is not present */
delete Object . keys ;
var shimmedKeys = keys . shim ( ) ;
assert . equal ( shimmedKeys , keys ) ;
assert . deepEqual ( Object . keys ( obj ) , keys ( obj ) ) ;
var keys = require ( 'object-keys' ) ;
var assert = require ( 'assert' ) ;
/* when Object.keys is present */
var shimmedKeys = keys . shim ( ) ;
assert . equal ( shimmedKeys , Object . keys ) ;
assert . deepEqual ( Object . keys ( obj ) , keys ( obj ) ) ;
Implementación tomada directamente de es5-shim, con modificaciones, incluso de lodash.
Simplemente clone el repositorio, npm install
y ejecute npm test