Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reflect.ownkeys

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reflect.ownkeys - npm Package Compare versions

Comparing version 0.2.0 to 1.0.0

.eslintrc

28

index.js

@@ -1,11 +0,17 @@

if (typeof Reflect === 'object' && typeof Reflect.ownKeys === 'function') {
module.exports = Reflect.ownKeys;
} else if (typeof Object.getOwnPropertySymbols === 'function') {
module.exports = function Reflect_ownKeys(o) {
return (
Object.getOwnPropertyNames(o).concat(Object.getOwnPropertySymbols(o))
);
}
} else {
module.exports = Object.getOwnPropertyNames;
}
'use strict';
var define = require('define-properties');
var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var shim = require('./shim');
var polyfill = getPolyfill();
define(polyfill, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = polyfill;
{
"name": "reflect.ownkeys",
"version": "0.2.0",
"description": "Polyfill for ES6's Reflect.ownKeys",
"main": "index.js",
"scripts": {
"test": "mocha"
},
"repository": {
"type": "git",
"url": "https://github.com/glenjamin/Reflect.ownKeys.git"
},
"keywords": [
"es6",
"reflect",
"ownkeys",
"polyfill"
],
"author": "Glen Mailer <glen@stainlessed.co.uk>",
"license": "MIT",
"bugs": {
"url": "https://github.com/glenjamin/Reflect.ownKeys/issues"
},
"homepage": "https://github.com/glenjamin/Reflect.ownKeys",
"devDependencies": {
"mocha": "^2.4.5"
}
"name": "reflect.ownkeys",
"version": "1.0.0",
"description": "ES2015 spec-compliant shim for Reflect.ownKeys",
"main": "index.js",
"exports": {
".": [
{
"default": "./index.js"
},
"./index.js"
],
"./auto": [
{
"default": "./auto.js"
},
"./auto.js"
],
"./shim": [
{
"default": "./shim.js"
},
"./shim.js"
],
"./polyfill": [
{
"default": "./polyfill.js"
},
"./polyfill.js"
],
"./implementation": [
{
"default": "./implementation.js"
},
"./implementation.js"
],
"./package": "./package.json",
"./package.json": "./package.json"
},
"scripts": {
"prepublish": "safe-publish-latest",
"lint": "eslint .",
"postlint": "es-shim-api --bound",
"pretest": "npm run lint",
"tests-only": "node test",
"test": "npm run tests-only",
"posttest": "npx aud",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "https://github.com/es-shims/Reflect.ownKeys.git"
},
"keywords": [
"es6",
"es2015",
"reflect",
"ownkeys",
"polyfill",
"shim",
"es-shim API"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"contributors": [
"Glen Mailer <glen@stainlessed.co.uk>"
],
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/es-shims/Reflect.ownKeys/issues"
},
"homepage": "https://github.com/es-shims/Reflect.ownKeys",
"devDependencies": {
"@es-shims/api": "^2.1.2",
"@ljharb/eslint-config": "^15.1.0",
"auto-changelog": "^1.16.2",
"eslint": "^6.8.0",
"has-symbols": "^1.0.1",
"safe-publish-latest": "^1.1.4",
"tape": "^5.0.0-next.3"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false
},
"dependencies": {
"define-properties": "^1.1.3",
"es-abstract": "^1.17.2",
"globalthis": "^1.0.1"
}
}

@@ -1,17 +0,55 @@

# Reflect.ownKeys
# reflect.ownkeys <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
Polyfill for ES6's [Reflect.ownKeys](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys)
[![Build Status][travis-svg]][travis-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
## Installing
[![npm badge][npm-badge-png]][package-url]
```sh
npm install reflect.ownkeys
```
An ES2015 spec-compliant `Reflect.ownKeys` shim. Invoke its "shim" method to shim `Reflect.ownKeys` if it is unavailable or noncompliant.
## Example
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.es/ecma262/#sec-reflect.ownkeys).
Most common usage:
```js
var assert = require('assert');
var ownKeys = require('reflect.ownkeys');
ownKeys({a: 1, b: 2});
// => [ "a", "b" ]
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`
[package-url]: https://npmjs.com/package/reflect.ownkeys
[npm-version-svg]: http://versionbadg.es/es-shims/Reflect.ownKeys.svg
[travis-svg]: https://travis-ci.org/es-shims/Reflect.ownKeys.svg
[travis-url]: https://travis-ci.org/es-shims/Reflect.ownKeys
[deps-svg]: https://david-dm.org/es-shims/Reflect.ownKeys.svg
[deps-url]: https://david-dm.org/es-shims/Reflect.ownKeys
[dev-deps-svg]: https://david-dm.org/es-shims/Reflect.ownKeys/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/Reflect.ownKeys#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/reflect.ownkeys.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/reflect.ownkeys.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/reflect.ownkeys.svg
[downloads-url]: http://npm-stat.com/charts.html?package=reflect.ownkeys

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc