360e4eb530a605920434ce5242ede89c03a833141d1c8f1704bbdbf7c21609ba8a5e9c41ec74c5868fc3bed26a69e9c57fbb43fde7ede552aef1b4deddce2c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # object.values <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
  2. [![github actions][actions-image]][actions-url]
  3. [![coverage][codecov-image]][codecov-url]
  4. [![dependency status][deps-svg]][deps-url]
  5. [![dev dependency status][dev-deps-svg]][dev-deps-url]
  6. [![License][license-image]][license-url]
  7. [![Downloads][downloads-image]][downloads-url]
  8. [![npm badge][npm-badge-png]][package-url]
  9. An ES2017 spec-compliant `Object.values` shim. Invoke its "shim" method to shim `Object.values` if it is unavailable or noncompliant.
  10. This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.github.io/ecma262/#sec-object.values).
  11. Most common usage:
  12. ```js
  13. var assert = require('assert');
  14. var values = require('object.values');
  15. var obj = { a: 1, b: 2, c: 3 };
  16. var expected = [1, 2, 3];
  17. if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') {
  18. // for environments with Symbol support
  19. var sym = Symbol();
  20. obj[sym] = 4;
  21. obj.d = sym;
  22. expected.push(sym);
  23. }
  24. assert.deepEqual(values(obj), expected);
  25. if (!Object.values) {
  26. values.shim();
  27. }
  28. assert.deepEqual(Object.values(obj), expected);
  29. ```
  30. ## Tests
  31. Simply clone the repo, `npm install`, and run `npm test`
  32. [package-url]: https://npmjs.com/package/object.values
  33. [npm-version-svg]: https://versionbadg.es/es-shims/Object.values.svg
  34. [deps-svg]: https://david-dm.org/es-shims/Object.values.svg
  35. [deps-url]: https://david-dm.org/es-shims/Object.values
  36. [dev-deps-svg]: https://david-dm.org/es-shims/Object.values/dev-status.svg
  37. [dev-deps-url]: https://david-dm.org/es-shims/Object.values#info=devDependencies
  38. [npm-badge-png]: https://nodei.co/npm/object.values.png?downloads=true&stars=true
  39. [license-image]: https://img.shields.io/npm/l/object.values.svg
  40. [license-url]: LICENSE
  41. [downloads-image]: https://img.shields.io/npm/dm/object.values.svg
  42. [downloads-url]: https://npm-stat.com/charts.html?package=object.values
  43. [codecov-image]: https://codecov.io/gh/es-shims/Object.values/branch/main/graphs/badge.svg
  44. [codecov-url]: https://app.codecov.io/gh/es-shims/Object.values/
  45. [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Object.values
  46. [actions-url]: https://github.com/es-shims/Object.values/actions