pax_global_header 0000666 0000000 0000000 00000000064 14735601673 0014526 g ustar 00root root 0000000 0000000 52 comment=91a8f0d8b9339eaea50002070e552ee1b88e94f7
es-shims-Reflect.getPrototypeOf-00db548/ 0000775 0000000 0000000 00000000000 14735601673 0020161 5 ustar 00root root 0000000 0000000 es-shims-Reflect.getPrototypeOf-00db548/.eslintrc 0000664 0000000 0000000 00000000327 14735601673 0022007 0 ustar 00root root 0000000 0000000 {
"root": true,
"extends": "@ljharb",
"rules": {
"id-length": 0,
"max-statements": [2, 25],
"new-cap": [2, {
"capIsNewExceptions": [
"GetIntrinsic",
"IsCallable",
"Type",
],
}],
},
}
es-shims-Reflect.getPrototypeOf-00db548/.github/ 0000775 0000000 0000000 00000000000 14735601673 0021521 5 ustar 00root root 0000000 0000000 es-shims-Reflect.getPrototypeOf-00db548/.github/workflows/ 0000775 0000000 0000000 00000000000 14735601673 0023556 5 ustar 00root root 0000000 0000000 es-shims-Reflect.getPrototypeOf-00db548/.github/workflows/node-aught.yml 0000664 0000000 0000000 00000000322 14735601673 0026331 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js < 10'
on: [pull_request, push]
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '< 10'
type: minors
command: npm run tests-only
es-shims-Reflect.getPrototypeOf-00db548/.github/workflows/node-noproto.yml 0000664 0000000 0000000 00000001375 14735601673 0026732 0 ustar 00root root 0000000 0000000 name: 'Tests: node --disable-proto=throw'
on: [pull_request, push]
jobs:
throw:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 12.17'
type: minors
skip-ls-check: true
after_install: "npm link && npm link dunder-proto"
command: "NODE_OPTIONS='--disable-proto=throw' npx tape 'tests/**/*.js'"
delete:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 12.17'
type: minors
skip-ls-check: true
after_install: "npm link && npm link dunder-proto"
command: "NODE_OPTIONS='--disable-proto=delete' npx tape 'tests/**/*.js'"
node:
name: 'node --disable-proto'
needs: [throw, delete]
runs-on: ubuntu-latest
steps:
- run: true
es-shims-Reflect.getPrototypeOf-00db548/.github/workflows/node-pretest.yml 0000664 0000000 0000000 00000000206 14735601673 0026710 0 ustar 00root root 0000000 0000000 name: 'Tests: pretest/posttest'
on: [pull_request, push]
jobs:
tests:
uses: ljharb/actions/.github/workflows/pretest.yml@main
es-shims-Reflect.getPrototypeOf-00db548/.github/workflows/node-tens.yml 0000664 0000000 0000000 00000000372 14735601673 0026177 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js 10 - 20'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 10 < 20'
type: minors
command: npm run tests-only
es-shims-Reflect.getPrototypeOf-00db548/.github/workflows/node-twenties.yml 0000664 0000000 0000000 00000002107 14735601673 0027066 0 ustar 00root root 0000000 0000000 name: 'Tests: node.js >= 20'
on: [pull_request, push]
permissions:
contents: read
jobs:
tests:
uses: ljharb/actions/.github/workflows/node.yml@main
with:
range: '>= 20'
type: minors
command: npm run tests-only
no-proto:
name: 'node, --disable-proto=delete'
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
disable-sudo: true
egress-policy: audit
allowed-endpoints: >
github.com:443
raw.githubusercontent.com:443
nodejs.org:443
iojs.org:443
registry.npmjs.org:443
actions-results-receiver-production.githubapp.com:443
- uses: actions/checkout@v4
with:
show-progress: false
- uses: ljharb/actions/node/install@main
- run: NODE_OPTIONS=--disable-proto=delete npm run tests-only
- uses: codecov/codecov-action@v3.1.5
finisher:
needs: [tests, no-proto]
name: 'node >= 20'
runs-on: ubuntu-latest
steps:
- run: true
es-shims-Reflect.getPrototypeOf-00db548/.github/workflows/rebase.yml 0000664 0000000 0000000 00000000257 14735601673 0025546 0 ustar 00root root 0000000 0000000 name: Automatic Rebase
on: [pull_request_target]
jobs:
_:
uses: ljharb/actions/.github/workflows/rebase.yml@main
secrets:
token: ${{ secrets.GITHUB_TOKEN }}
es-shims-Reflect.getPrototypeOf-00db548/.github/workflows/require-allow-edits.yml 0000664 0000000 0000000 00000000303 14735601673 0030173 0 ustar 00root root 0000000 0000000 name: Require “Allow Edits”
on: [pull_request_target]
jobs:
_:
name: "Require “Allow Edits”"
runs-on: ubuntu-latest
steps:
- uses: ljharb/require-allow-edits@main
es-shims-Reflect.getPrototypeOf-00db548/.gitignore 0000664 0000000 0000000 00000003251 14735601673 0022152 0 ustar 00root root 0000000 0000000 # Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Only apps should have lockfiles
npm-shrinkwrap.json
package-lock.json
yarn.lock
.npmignore
es-shims-Reflect.getPrototypeOf-00db548/.npmrc 0000664 0000000 0000000 00000000067 14735601673 0021304 0 ustar 00root root 0000000 0000000 package-lock=false
allow-same-version=true
message=v%s
es-shims-Reflect.getPrototypeOf-00db548/.nycrc 0000664 0000000 0000000 00000000213 14735601673 0021274 0 ustar 00root root 0000000 0000000 {
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}
es-shims-Reflect.getPrototypeOf-00db548/CHANGELOG.md 0000664 0000000 0000000 00000024022 14735601673 0021772 0 ustar 00root root 0000000 0000000 # Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.0.10](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.9...v1.0.10) - 2025-01-02
### Commits
- [Refactor] use `es-object-atoms` and `get-proto` directly [`2c55da0`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/2c55da02fb56d9ce7a19e505f487dfb088256d24)
- [Refactor] use `isObject` helper instead of `Type` [`e4c24a4`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/e4c24a4cc1b9928da3eb1f0a032703235d32855e)
- [Deps] update `es-abstract`, `get-intrinsic` [`54005fb`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/54005fb9df56fb399e0c526600cb7799d23ef64f)
- [Deps] update `es-abstract` [`e71b3b7`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/e71b3b75847d4af71e42ff049bd2b4d55f0324fc)
## [v1.0.9](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.8...v1.0.9) - 2024-12-18
### Commits
- [Fix] avoid a crash with node `--disable-proto=throw` flag [`73f449d`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/73f449dff08fe574a4cd937d7265aceb1774de05)
- [Deps] update `dunder-proto`, `es-abstract`, `get-intrinsic`, `which-builtin-type` [`80c8227`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/80c8227aac6cef446ac8460f8bbdd9a83bd1d131)
## [v1.0.8](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.7...v1.0.8) - 2024-12-06
### Commits
- [Refactor] share the getDunderProto helper [`f4be71b`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/f4be71b2941f217311210a00d84d8338b4880e2a)
- [Refactor] extract helper to `dunder-proto` [`51dcd35`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/51dcd3547ef9808c9fee7aa4a638d3d5d93db70c)
- [Deps] update `call-bind` [`c06e8d3`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/c06e8d3c1c9b567ca5bd6bb8542ae2e342f276ff)
- [Deps] update `gopd` [`c951a70`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/c951a709d5483fecc4041287a676d881295d1940)
- [Deps] update `gopd` [`8bd7b85`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/8bd7b8524aacc0574c979e3fe4f82adc51b03f3f)
- [Deps] update `which-builtin-type` [`f46f624`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/f46f62423c1c452063f73d34a363c127410742b2)
## [v1.0.7](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.6...v1.0.7) - 2024-11-23
### Commits
- [Fix] cache `Object.prototype[__proto__]` getter [`68acea1`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/68acea171951197f83bb107af9e186ce68a5a78f)
- [Tests] remove unused test file [`055596a`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/055596aa2e050e08d35f8f19aa642e9b61a54f7f)
- [actions] split out node 10-20, and 20+ [`99a57c2`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/99a57c2551d11de70ea90b934e02b04ff3cec6c0)
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `auto-changelog`, `tape` [`fe4bb92`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/fe4bb92a4d629e629f42f76567d837f8f17643a4)
- [Deps] update `es-abstract`, `globalthis`, `which-builtin-type` [`867aeb3`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/867aeb3c434ee03fd819da09d23a32a2c71290dc)
- [Tests] replace `aud` with `npm audit` [`5129c11`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/5129c112e18e3475afe42a836ac5d4d7ddfcfc18)
- [Deps] remove unused dep; add missing dev dep [`23cf537`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/23cf537aeac98bf27a8d39e24048e1c9fa4df7a7)
- [Dev Deps] add missing peer dep [`18862fa`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/18862fa57d2aa86825998db935ac6ffe23dec113)
## [v1.0.6](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.5...v1.0.6) - 2024-03-16
### Commits
- [meta] remove useless ESM [`cc16ab1`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/cc16ab1f3b050c9465b41fbbf79e284e8e9084ff)
- [Deps] update `call-bind`, `es-abstract`, `es-errors`, `get-intrinsic` [`ece7445`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/ece7445f03d148c67f5fc91ea455a05731b54cea)
- [Dev Deps] update `tape` [`a894b62`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/a894b624c16247cbb76a00e76a39e3d44ac5bccf)
## [v1.0.5](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.4...v1.0.5) - 2024-02-04
### Commits
- [Refactor] use `es-errors` where possible, so things that only need those do not need `get-intrinsic` [`08735cb`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/08735cba1dfeabae4e362b61e6de36843a472d22)
- [Deps] update `call-bind`, `define-properties`, `es-abstract`, `get-intrinsic` [`b5700ec`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/b5700eca8af88bbc693b304567d6124d13c03827)
- [Dev Deps] update `aud`, `npmignore`, `tape` [`f80fcbb`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/f80fcbb140661c07aa2a94547ffae0a5a8f937ac)
## [v1.0.4](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.3...v1.0.4) - 2023-08-30
### Commits
- [Deps] update `define-properties`, `es-abstract`, `get-intrinsic` [`325044f`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/325044f152c87f18344ba558b5967e69298a5dd2)
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`56b9555`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/56b9555a536207493c4e2c17f1fee2390535a659)
## [v1.0.3](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.2...v1.0.3) - 2022-11-07
### Commits
- [actions] reuse common workflows [`0a76d97`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/0a76d972c13cd319504d3eecf8e7e00e39327c88)
- [meta] use `npmignore` to autogenerate an npmignore file [`c4861b4`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/c4861b45aeebddd1d998bdd44438b29e4bf974e8)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`e5352ab`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/e5352ab099f7104c085ffd2ee8fbfec69546fa2c)
- [actions] update codecov uploader [`dbcedf8`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/dbcedf83e967e17316fc98fb18011c603bb54823)
- [Deps] update `define-properties`, `es-abstract`, `globalthis`, `which-builtin-type` [`84fbfab`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/84fbfabe53774587be4748df303cec8acded7c0f)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`75dc8a3`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/75dc8a337f11f11a947241c968bb7f5b843a1d17)
- [actions] update rebase action to use reusable workflow [`49463a7`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/49463a7a6d9aaa08c201ff4206efcade7a997175)
- [Dev Deps] update `@es-shims/api` [`adf75cb`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/adf75cb9dbda9052437a8e48e33da28dc52aa63c)
## [v1.0.2](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.1...v1.0.2) - 2021-10-03
### Commits
- [Deps] update `es-abstract` [`947bbb1`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/947bbb1bff0cc08ab80bb809a19771c6087e9fda)
- [actions] update workflows` [`af4708d`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/af4708d75212ee5781b549b1ff86f903fc659e3f)
## [v1.0.1](https://github.com/es-shims/Reflect.getPrototypeOf/compare/v1.0.0...v1.0.1) - 2021-09-08
### Commits
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`86f4aa3`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/86f4aa392c73220ecb561d644def5c3efab4f9f5)
- [Refactor] remove unnecessary ESM files [`162e4bf`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/162e4bfb58fb4eba6f2f26f11b0f46a8ea6587a7)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `auto-changelog`, `tape` [`5515a8d`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/5515a8d17fc1978792db7e57a79f7f2fa60dc55e)
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`db05b43`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/db05b43dff616acab04544ab04bd385d462b8572)
- [readme] add github actions/codecov badges [`d9ea295`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/d9ea295264f1d415b5083b3d4116b14a5a8ee7ff)
- [Deps] update `es-abstract`, `which-builtin-type` [`1753dee`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/1753deeaadbd66bb65e140e4bc81cee6652f07cd)
- [Dev Deps] update `eslint`, `tape` [`4bce2db`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/4bce2db34c4182edd0bf3610eaeb1ea42844ee15)
- [Deps] update `es-abstract`, `get-intrinsic` [`1dca685`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/1dca685d1e5305b6720882ac8f4d5038a8309431)
- [meta] use `prepublishOnly` script for npm 7+ [`1108273`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/1108273eba643ac8b135d177c21dd371ccb32901)
- [actions] update workflows [`8674d66`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/8674d662705675531d216bdba2b7e1e26be1b12b)
- [Deps] update `es-abstract` [`4e4fdcf`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/4e4fdcf854f3cd71d71aa80723664f5d2b814dad)
## v1.0.0 - 2021-01-12
### Commits
- es-shims initial commit [`ffd0b98`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/ffd0b980b47f0b2db6bc3373364e950f6fce33cb)
- Initial commit [`64c868f`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/64c868fa1bb3630f4ab823aaba98d0f28b3f8078)
- [meta] add Automatic Rebase and Require Allow Edits workflows [`6a006b4`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/6a006b4ddebfe68fd23b2870c83aadefecf80b04)
- [meta] Only apps should have lockfiles [`d1a29b5`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/d1a29b5b37d31129ecc1fecac1922d4c4935f9fa)
- [Deps] update `call-bind` [`bfcc1a0`](https://github.com/es-shims/Reflect.getPrototypeOf/commit/bfcc1a0bd04fffe5fe53e791dd40f7988bbd5d03)
es-shims-Reflect.getPrototypeOf-00db548/LICENSE 0000664 0000000 0000000 00000002061 14735601673 0021165 0 ustar 00root root 0000000 0000000 MIT License
Copyright (c) 2021 ECMAScript Shims
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
es-shims-Reflect.getPrototypeOf-00db548/README.md 0000664 0000000 0000000 00000007250 14735601673 0021444 0 ustar 00root root 0000000 0000000 # reflect.getprototypeof [![Version Badge][npm-version-svg]][package-url]
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-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]
[![npm badge][npm-badge-png]][package-url]
An ES2015 mostly-spec-compliant `Reflect.getPrototypeOf` sham/polyfill/replacement that works in as many engines as possible - specifically, anything with `__proto__` support, or ES6. Built-in types will also work correctly in older engines.
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://www.ecma-international.org/ecma-262/5.1/).
## Example
```js
var getPrototypeOf = require('reflect.getprototypeof');
var assert = require('assert');
assert.throws(() => getPrototypeOf(true));
assert.throws(() => getPrototypeOf(42));
assert.throws(() => getPrototypeOf(''));
assert.equal(getPrototypeOf(/a/g), RegExp.prototype);
assert.equal(getPrototypeOf(new Date()), Date.prototype);
assert.equal(getPrototypeOf(function () {}), Function.prototype);
assert.equal(getPrototypeOf([]), Array.prototype);
assert.equal(getPrototypeOf({}), Object.prototype);
```
```js
var getPrototypeOf = require('reflect.getprototypeof');
var assert = require('assert');
/* when Reflect or Reflect.getPrototypeOf is not present */
if (typeof Reflect === 'object') { delete Reflect.getPrototypeOf; }
delete globalThis.Reflect;
var shimmed = getPrototypeOf.shim();
assert.equal(shimmed, getPrototypeOf.getPolyfill());
assert.throws(() => Reflect.getPrototypeOf(true));
assert.throws(() => Reflect.getPrototypeOf(42));
assert.throws(() => Reflect.getPrototypeOf(''));
assert.equal(Reflect.getPrototypeOf(/a/g), RegExp.prototype);
assert.equal(Reflect.getPrototypeOf(new Date()), Date.prototype);
assert.equal(Reflect.getPrototypeOf(function () {}), Function.prototype);
assert.equal(Reflect.getPrototypeOf([]), Array.prototype);
assert.equal(Reflect.getPrototypeOf({}), Object.prototype);
```
```js
var getPrototypeOf = require('reflect.getprototypeof');
var assert = require('assert');
/* when Reflect.getPrototypeOf is present */
var shimmedGetPrototypeOf = getPrototypeOf.shim();
assert.equal(shimmedGetPrototypeOf, Reflect.getPrototypeOf);
assert.equal(Reflect.getPrototypeOf([]), Array.prototype);
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/reflect.getprototypeof
[npm-version-svg]: https://versionbadg.es/es-shims/Reflect.getPrototypeOf.svg
[deps-svg]: https://david-dm.org/es-shims/Reflect.getPrototypeOf.svg
[deps-url]: https://david-dm.org/es-shims/Reflect.getPrototypeOf
[dev-deps-svg]: https://david-dm.org/es-shims/Reflect.getPrototypeOf/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/Reflect.getPrototypeOf#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/reflect.getprototypeof.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/reflect.getprototypeof.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/reflect.getprototypeof.svg
[downloads-url]: https://npm-stat.com/charts.html?package=reflect.getprototypeof
[codecov-image]: https://codecov.io/gh/es-shims/Reflect.getPrototypeOf/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/Reflect.getPrototypeOf/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Reflect.getPrototypeOf
[actions-url]: https://github.com/es-shims/Reflect.getPrototypeOf/actions
es-shims-Reflect.getPrototypeOf-00db548/auto.js 0000664 0000000 0000000 00000000044 14735601673 0021465 0 ustar 00root root 0000000 0000000 'use strict';
require('./shim')();
es-shims-Reflect.getPrototypeOf-00db548/implementation.js 0000664 0000000 0000000 00000002103 14735601673 0023540 0 ustar 00root root 0000000 0000000 'use strict';
var GetIntrinsic = require('get-intrinsic');
var IsCallable = require('es-abstract/2024/IsCallable');
var isObject = require('es-abstract/helpers/isObject');
var whichBuiltinType = require('which-builtin-type');
var $TypeError = require('es-errors/type');
var gPO = require('get-proto');
var $Object = require('es-object-atoms');
module.exports = function getPrototypeOf(O) {
if (!isObject(O)) {
throw new $TypeError('Reflect.getPrototypeOf called on non-object');
}
if (gPO) {
return gPO(O);
}
var type = whichBuiltinType(O);
if (type) {
var intrinsic = GetIntrinsic('%' + type + '.prototype%', true);
if (intrinsic) {
return intrinsic;
}
}
if (IsCallable(O.constructor)) {
return O.constructor.prototype;
}
if (O instanceof Object) {
return $Object.prototype;
}
/*
* Correctly return null for Objects created with `Object.create(null)` (shammed or native) or `{ __proto__: null}`. Also returns null for
* cross-realm objects on browsers that lack `__proto__` support (like IE <11), but that's the best we can do.
*/
return null;
};
es-shims-Reflect.getPrototypeOf-00db548/index.js 0000664 0000000 0000000 00000000645 14735601673 0021633 0 ustar 00root root 0000000 0000000 'use strict';
var callBind = require('call-bind');
var define = require('define-properties');
var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var shim = require('./shim');
var bound = callBind(getPolyfill(), typeof Reflect === 'object' ? Reflect : Object);
define(bound, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = bound;
es-shims-Reflect.getPrototypeOf-00db548/package.json 0000664 0000000 0000000 00000005136 14735601673 0022454 0 ustar 00root root 0000000 0000000 {
"name": "reflect.getprototypeof",
"version": "1.0.10",
"description": "An ES2015 mostly-spec-compliant `Reflect.getPrototypeOf` sham/polyfill/replacement that works in as many engines as possible",
"main": "index.js",
"type": "commonjs",
"exports": {
".": "./index.js",
"./auto": "./auto.js",
"./polyfill": "./polyfill.js",
"./implementation": "./implementation.js",
"./shim": "./shim.js",
"./package.json": "./package.json"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "es-shim-api --bound",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "npx npm@'>=10.2' audit --production",
"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": "git+https://github.com/es-shims/Reflect.getPrototypeOf.git"
},
"keywords": [
"Reflect.getPrototypeOf",
"Object.getPrototypeOf",
"proto",
"__proto__",
"[[Prototype]]",
"getPrototypeOf",
"ES5",
"shim",
"polyfill",
"es-shim API",
"browser"
],
"author": "Jordan Harband ",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/es-shims/Reflect.getPrototypeOf/issues"
},
"homepage": "https://github.com/es-shims/Reflect.getPrototypeOf",
"engines": {
"node": ">= 0.4"
},
"dependencies": {
"call-bind": "^1.0.8",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.9",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.0.0",
"get-intrinsic": "^1.2.7",
"get-proto": "^1.0.1",
"which-builtin-type": "^1.2.1"
},
"devDependencies": {
"@es-shims/api": "^2.5.1",
"@ljharb/eslint-config": "^21.1.1",
"auto-changelog": "^2.5.0",
"encoding": "^0.1.13",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"functions-have-names": "^1.2.3",
"in-publish": "^2.0.1",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
},
"testling": {
"files": "test/implementation.js"
}
}
es-shims-Reflect.getPrototypeOf-00db548/polyfill.js 0000664 0000000 0000000 00000000536 14735601673 0022355 0 ustar 00root root 0000000 0000000 'use strict';
var implementation = require('./implementation');
var getProto = require('get-proto');
module.exports = function getPolyfill() {
if (typeof Reflect === 'object' && Reflect && Reflect.getPrototypeOf) {
return Reflect.getPrototypeOf;
}
return getProto
? function getPrototypeOf(O) { return getProto(O); }
: implementation;
};
es-shims-Reflect.getPrototypeOf-00db548/shim.js 0000664 0000000 0000000 00000000716 14735601673 0021463 0 ustar 00root root 0000000 0000000 'use strict';
var define = require('define-properties');
var getPolyfill = require('./polyfill');
module.exports = function shimGetPrototypeOf() {
define(
global,
{ Reflect: {} },
{ Reflect: function () { return typeof Reflect !== 'object' || !Reflect; } }
);
var polyfill = getPolyfill();
define(
Reflect,
{ getPrototypeOf: polyfill },
{ getPrototypeOf: function () { return Reflect.getPrototypeOf !== polyfill; } }
);
return polyfill;
};
es-shims-Reflect.getPrototypeOf-00db548/test/ 0000775 0000000 0000000 00000000000 14735601673 0021140 5 ustar 00root root 0000000 0000000 es-shims-Reflect.getPrototypeOf-00db548/test/implementation.js 0000664 0000000 0000000 00000000324 14735601673 0024522 0 ustar 00root root 0000000 0000000 'use strict';
var getPrototypeOf = require('../implementation');
var test = require('tape');
var runTests = require('./tests');
test('as a function', function (t) {
runTests(getPrototypeOf, t);
t.end();
});
es-shims-Reflect.getPrototypeOf-00db548/test/index.js 0000664 0000000 0000000 00000000306 14735601673 0022604 0 ustar 00root root 0000000 0000000 'use strict';
var getPrototypeOf = require('../');
var test = require('tape');
var runTests = require('./tests');
test('as a function', function (t) {
runTests(getPrototypeOf, t);
t.end();
});
es-shims-Reflect.getPrototypeOf-00db548/test/shimmed.js 0000664 0000000 0000000 00000001535 14735601673 0023130 0 ustar 00root root 0000000 0000000 'use strict';
require('../auto');
var test = require('tape');
var defineProperties = require('define-properties');
var isEnumerable = Object.prototype.propertyIsEnumerable;
var functionsHaveNames = require('functions-have-names')();
var runTests = require('./tests');
test('shimmed', function (t) {
t.equal(Reflect.getPrototypeOf.length, 1, 'Reflect.getPrototypeOf has length of 1');
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
st.equal(Reflect.getPrototypeOf.name, 'getPrototypeOf', 'Reflect.getPrototypeOf has name "getPrototypeOf"');
st.end();
});
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
et.equal(false, isEnumerable.call(Reflect, 'getPrototypeOf'), 'Reflect.getPrototypeOf is not enumerable');
et.end();
});
runTests(Reflect.getPrototypeOf, t);
t.end();
});
es-shims-Reflect.getPrototypeOf-00db548/test/tests.js 0000664 0000000 0000000 00000003132 14735601673 0022637 0 ustar 00root root 0000000 0000000 'use strict';
module.exports = function (getPrototypeOf, t) {
t.test('nullish value', function (st) {
st['throws'](function () { return getPrototypeOf(undefined); }, TypeError, 'undefined is not an object');
st['throws'](function () { return getPrototypeOf(null); }, TypeError, 'null is not an object');
st.end();
});
t['throws'](function () { getPrototypeOf(true); }, 'throws for true');
t['throws'](function () { getPrototypeOf(false); }, 'throws for false');
t['throws'](function () { getPrototypeOf(42); }, 'throws for 42');
t['throws'](function () { getPrototypeOf(NaN); }, 'throws for NaN');
t['throws'](function () { getPrototypeOf(0); }, 'throws for +0');
t['throws'](function () { getPrototypeOf(-0); }, 'throws for -0');
t['throws'](function () { getPrototypeOf(Infinity); }, 'throws for ∞');
t['throws'](function () { getPrototypeOf(-Infinity); }, 'throws for -∞');
t['throws'](function () { getPrototypeOf(''); }, 'throws for empty string');
t['throws'](function () { getPrototypeOf('foo'); }, 'throws for non-empty string');
t.equal(getPrototypeOf(/a/g), RegExp.prototype);
t.equal(getPrototypeOf(new Date()), Date.prototype);
t.equal(getPrototypeOf(function () {}), Function.prototype);
t.equal(getPrototypeOf([]), Array.prototype);
t.equal(getPrototypeOf({}), Object.prototype);
var obj = { __proto__: null };
if ('toString' in obj) {
t.comment('no null objects in this engine');
t.equal(getPrototypeOf(obj), Object.prototype, '"null" object has Object.prototype as [[Prototype]]');
} else {
t.equal(getPrototypeOf(obj), null, 'null object has null [[Prototype]]');
}
};