a5275fa23d5e802c9e371045ece66b33bc714d96f8471c407669f61f72dfc406f33cb5f64cd40d539148a232d65565f7607bcb7d657674e0339aa1988feecb 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # own-keys <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
  2. [![github actions][actions-image]][actions-url]
  3. [![coverage][codecov-image]][codecov-url]
  4. [![License][license-image]][license-url]
  5. [![Downloads][downloads-image]][downloads-url]
  6. [![npm badge][npm-badge-png]][package-url]
  7. Robustly get an object's own property keys (strings and symbols), including non-enumerables when possible.
  8. ## Getting started
  9. ```sh
  10. npm install --save own-keys
  11. ```
  12. ## Usage/Examples
  13. ```js
  14. var ownKeys = require('own-keys');
  15. var assert = require('assert');
  16. assert.deepEqual(ownKeys({ a: 1, b: 2 }), ['a', 'b']);
  17. assert.deepEqual(ownKeys([1, 2, 3]), [0, 1, 2, 'length']);
  18. ```
  19. ## Tests
  20. Simply clone the repo, `npm install`, and run `npm test`
  21. [package-url]: https://npmjs.org/package/own-keys
  22. [npm-version-svg]: https://versionbadg.es/ljharb/own-keys.svg
  23. [deps-svg]: https://david-dm.org/ljharb/own-keys.svg
  24. [deps-url]: https://david-dm.org/ljharb/own-keys
  25. [dev-deps-svg]: https://david-dm.org/ljharb/own-keys/dev-status.svg
  26. [dev-deps-url]: https://david-dm.org/ljharb/own-keys#info=devDependencies
  27. [npm-badge-png]: https://nodei.co/npm/own-keys.png?downloads=true&stars=true
  28. [license-image]: https://img.shields.io/npm/l/own-keys.svg
  29. [license-url]: LICENSE
  30. [downloads-image]: https://img.shields.io/npm/dm/own-keys.svg
  31. [downloads-url]: https://npm-stat.com/charts.html?package=own-keys
  32. [codecov-image]: https://codecov.io/gh/ljharb/own-keys/branch/main/graphs/badge.svg
  33. [codecov-url]: https://app.codecov.io/gh/ljharb/own-keys/
  34. [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/own-keys
  35. [actions-url]: https://github.com/ljharb/own-keys/actions