Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

reflect.ownkeys

es-shims4mMIT1.1.5TypeScript support: definitely-typed

ES2015 spec-compliant shim for Reflect.ownKeys

es6, es2015, reflect, ownkeys, polyfill, shim, es-shim API

readme

reflect.ownkeys Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES2015 spec-compliant Reflect.ownKeys shim. Invoke its "shim" method to shim Reflect.ownKeys if it is unavailable or noncompliant.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.

Most common usage:

var assert = require('assert');
var ownKeys = require('reflect.ownkeys');

var obj = { a: 1, b: 2, c: 3 };
var expected = ['a', 'b', 'c'];

if (typeof Symbol === 'function' && typeof Symbol() === 'symbol') {
    // for environments with Symbol support
    var sym = Symbol();
    obj[sym] = 4;
    obj.d = sym;
    expected.push(sym, 'd');
}

assert.deepEqual(ownKeys(obj), expected);

if (!Reflect.ownKeys) {
    ownKeys.shim();
}

assert.deepEqual(Reflect.ownKeys(obj), expected);

Tests

Simply clone the repo, npm install, and run npm test

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.1.5 - 2024-12-29

Commits

  • [meta] remove useless ESM 409aed3
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, auto-changelog, has-symbols, npmignore, tape 26459fa
  • [Deps] update call-bind, define-properties, es-abstract, es-set-tostringtag, globalthis 01e75d0
  • [Refactor] use own-keys 8726824
  • [Deps] update es-abstract, own-keys 68cfc76
  • [meta] add missing engines.node 36fecb9
  • [Tests] replace aud with npm audit 1f3cca2
  • [Dev Deps] add missing peer dep f00ecf4

v1.1.4 - 2023-08-29

Commits

  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, tape 061ea8e
  • [Deps] update define-properties, es-abstract 2834d7f

v1.1.3 - 2023-01-19

Commits

  • [Deps] update es-abstract, es-set-tostringtag 9fa81be
  • [Dev Deps] update @ljharb/eslint-config, tape 68534a7

v1.1.2 - 2022-12-21

Commits

  • [Refactor] use es-set-tostringtag 5b6e7bd
  • [Dev Deps] update aud d7d33e6
  • [Deps] update es-abstract 04b342c

v1.1.1 - 2022-11-07

Commits

  • [actions] reuse common workflows fce754f
  • [meta] use npmignore to autogenerate an npmignore file ae06130
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, functions-have-names, has-symbols, tape f8c24f1
  • [Dev Deps] update eslint, @ljharb/eslint-config, @es-shims/api, safe-publish-latest, tape a25e141
  • [actions] update codecov uploader 22a8d65
  • [actions] update rebase action to use reusable workflow 483bf80
  • [Deps] update define-properties, es-abstract, globalthis 1e1a633

v1.1.0 - 2021-10-04

Commits

  • [New] add main ESM entry point a4eda1e
  • [actions] use node/install instead of node/run; use codecov action b4d419e
  • [Fix] shim Reflect[Symbol.toStringTag] when needed c5952eb
  • [Dev Deps] update eslint, @ljharb/eslint-config, @es-shims/api, aud, auto-changelog, tape de6abd1
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, call-bind, tape 49bbcd3
  • [readme] add github actions/codecov badges 422dfdd
  • [Dev Deps] update eslint, has-symbols, tape 6c3825d
  • [Deps] update es-abstract, globalthis eca0e12
  • [actions] update workflows ee73576
  • [meta] use prepublishOnly script for npm 7+ f470670
  • [actions] update workflows a6e7274
  • [Deps] update es-abstract ec32dd8
  • [Fix] move call-bind to prod deps 4056614
  • [Deps] update es-abstract 93bbc28

v1.0.2 - 2020-12-24

Commits

  • [Tests] migrate tests to Github Actions 542dff9
  • [Tests] complete test suite 913267b
  • [meta] do not publish github action workflow files ec9eeae
  • [Tests] run nyc on all tests; use tape runner 8483ad1
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape 9ef3908
  • [readme] fix repo URLs; remove defunct badges f29aadc
  • [Fix] shim: install Reflect on the global when it is not available d7d00e0
  • [actions] add "Allow Edits" workflow 00dfcd4
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, tape 05a5da6
  • [Refactor] use call-bind instead of es-abstract where appropriate; update es-abstract 2e2116c
  • [actions] switch Automatic Rebase workflow to pull_request_target event 613356b
  • [Dev Deps] update aud, auto-changelog 175764b
  • [Dev Deps] update auto-changelog, tape abd63ef
  • [Tests] only audit prod deps 98f754e
  • [Deps] update es-abstract e532e6f

v1.0.1 - 2020-01-31

Commits

  • [readme] add greenkeeper badge c846b42
  • [Dev Deps] update @ljharb/eslint-config, tape 2da9d9a
  • [Fix] do not mutate the builtin function 86a55d8
  • [Deps] update es-abstract d57567a

v1.0.0 - 2020-01-15

Commits

  • [Tests] switch from mocha to tape 7c89acb
  • [Tests] add eslint 06b73d1
  • [meta] add auto-changelog f84b409
  • [Breaking] refactor to use robust implementation, and conform to the es-shim API interface 2180eab
  • [readme] update docs and repo URLs 45be649
  • [Breaking] add "exports" to package.json 6c25c03
  • [Tests] use shared travis-ci configs adb8dd8
  • [actions] add automatic rebasing / merge commit blocking b80d8f3
  • [Tests] avoid caring about key ordering for now 6624e2b
  • Only apps should have lockfiles d418feb
  • [meta] add funding field ef508d0
  • [meta] add safe-publish-latest 97d4a84
  • [Tests] add npx aud in posttest 5c57ad5

v0.2.0 - 2016-02-06

Commits