object keys
1.0.0
Object.keys 심. Object.keys를 사용할 수 없는 경우 "shim" 메서드를 호출하여 Object.keys를 심합니다.
가장 일반적인 사용법:
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 ) ) ;
lodash를 포함한 수정 사항을 포함하여 es5-shim에서 직접 구현했습니다.
저장소를 복제하고 npm install
실행하고 npm test
실행하기만 하면 됩니다.