New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

getprototypeof

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

getprototypeof - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

.eslintignore

32

index.js

@@ -1,13 +0,21 @@

/* eslint-env node, browser */
/* eslint no-proto: 0 */
module.exports = function (object) {
"use strict";
var proto = object.__proto__;
if (proto || proto === null) {
return proto;
} else if (object.constructor) {
return object.constructor.prototype;
} else {
return Object.prototype;
}
'use strict';
var callBind = require('call-bind');
var define = require('define-properties');
var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var polyfill = callBind(getPolyfill(), Object);
var shim = require('./shim');
var bound = function getPrototypeOf(value) {
return polyfill(value);
};
define(bound, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = bound;
{
"name": "getprototypeof",
"version": "1.0.0",
"description": "Object.getPrototypeOf sham function",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/mightyiam/getprototypeof.git"
},
"keywords": [
"shim",
"browser"
],
"author": "Shahar Or <mightyiampresence@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/mightyiam/getprototypeof/issues"
},
"homepage": "https://github.com/mightyiam/getprototypeof"
"name": "getprototypeof",
"version": "2.0.0",
"description": "An ES5 mostly-spec-compliant `Object.getPrototypeOf` sham/polyfill/replacement that works in as many engines as possible",
"main": "index.js",
"type": "commonjs",
"exports": {
".": [
{
"import": "./index.mjs",
"default": "./index.js"
},
"./index.js"
],
"./polyfill": [
{
"import": "./polyfill.mjs",
"default": "./polyfill.js"
},
"./polyfill.js"
],
"./implementation": [
{
"import": "./implementation.mjs",
"default": "./implementation.js"
},
"./implementation.js"
],
"./shim": [
{
"import": "./shim.mjs",
"default": "./shim.js"
},
"./shim.js"
],
"./auto": [
{
"import": "./auto.mjs",
"default": "./auto.js"
},
"./auto.js"
],
"./package.json": "./package.json"
},
"scripts": {
"prepublish": "safe-publish-latest",
"prelint": "evalmd README.md",
"lint": "eslint .",
"postlint": "es-shim-api --bound",
"pretest": "npm run lint",
"tests-only": "nyc tape 'test/**/*.js'",
"tests-esm": "nyc node test/index.mjs",
"test": "npm run tests-only && npm run tests-esm",
"posttest": "aud --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/Object.getPrototypeOf.git"
},
"keywords": [
"Object.getPrototypeOf",
"proto",
"__proto__",
"[[Prototype]]",
"getPrototypeOf",
"ES5",
"shim",
"polyfill",
"es-shim API",
"browser"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/es-shims/Object.getPrototypeOf/issues"
},
"homepage": "https://github.com/es-shims/Object.getPrototypeOf",
"engines": {
"node": ">= 0.4"
},
"devDependencies": {
"@es-shims/api": "^2.1.2",
"@ljharb/eslint-config": "^17.3.0",
"aud": "^1.1.3",
"auto-changelog": "^2.2.1",
"eslint": "^7.16.0",
"evalmd": "^0.0.19",
"nyc": "^10.3.2",
"safe-publish-latest": "^1.1.4",
"tape": "^5.0.1"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"dependencies": {
"call-bind": "^1.0.0",
"define-properties": "^1.1.3",
"es-abstract": "^1.18.0-next.1",
"get-intrinsic": "^1.0.2",
"which-builtin-type": "^1.0.1"
}
}

@@ -1,19 +0,70 @@

# getprototypeof
# getprototypeof <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
As [the shim sham here](https://github.com/es-shims/es5-shim#shams), as a
function.
[![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]
## Install
[![npm badge][npm-badge-png]][package-url]
An ES5 mostly-spec-compliant `Object.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('getprototypeof');
var assert = require('assert');
assert.equal(getPrototypeOf(true), Boolean.prototype);
assert.equal(getPrototypeOf(42), Number.prototype);
assert.equal(getPrototypeOf(''), String.prototype);
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);
```
npm i getprototypeof
```
## Use
```js
var getPrototypeOf = require('getprototypeof');
var assert = require('assert');
/* when Object.getPrototypeOf is not present */
delete Object.getPrototypeOf;
var shimmed = getPrototypeOf.shim();
assert.equal(shimmed, getPrototypeOf.getPolyfill());
assert.equal(Object.getPrototypeOf(true), Boolean.prototype);
assert.equal(Object.getPrototypeOf(42), Number.prototype);
assert.equal(Object.getPrototypeOf(''), String.prototype);
assert.equal(Object.getPrototypeOf(/a/g), RegExp.prototype);
assert.equal(Object.getPrototypeOf(new Date()), Date.prototype);
assert.equal(Object.getPrototypeOf(function () {}), Function.prototype);
assert.equal(Object.getPrototypeOf([]), Array.prototype);
assert.equal(Object.getPrototypeOf({}), Object.prototype);
```
var getPrototypeOf = require("getprototypeof");
proto = getPrototypeOf(someObject);
```js
var getPrototypeOf = require('getprototypeof');
var assert = require('assert');
/* when Object.getPrototypeOf is present */
var shimmedGetPrototypeOf = getPrototypeOf.shim();
assert.equal(shimmedGetPrototypeOf, Object.getPrototypeOf);
assert.equal(Object.getPrototypeOf([]), Array.prototype);
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/getprototypeof
[npm-version-svg]: https://versionbadg.es/es-shims/Object.getPrototypeOf.svg
[deps-svg]: https://david-dm.org/es-shims/Object.getPrototypeOf.svg
[deps-url]: https://david-dm.org/es-shims/Object.getPrototypeOf
[dev-deps-svg]: https://david-dm.org/es-shims/Object.getPrototypeOf/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/Object.getPrototypeOf#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/getprototypeof.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/getprototypeof.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/getprototypeof.svg
[downloads-url]: https://npm-stat.com/charts.html?package=getprototypeof

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