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

arity-of

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arity-of - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

26

index.js

@@ -6,3 +6,4 @@ 'use strict';

// robust against the environment being modified after it is required.
const { prototype } = Function;
const FunctionBuiltin = {}.constructor.constructor;
const { prototype } = FunctionBuiltin;
const { toString } = prototype;

@@ -114,4 +115,3 @@ const { apply } = Reflect;

arityOf.getPolyfill = function getPolyfill() {
// TODO: look for native
return arityOf;
return FunctionBuiltin.arityOf || arityOf;
};

@@ -126,4 +126,15 @@

arityOf.shim = function shim() {
if (!hasOwnProperty(prototype, 'maxArity')) {
const polyfill = arityOf.getPolyfill();
if (!apply(hasOwnProperty, FunctionBuiltin, [ 'arityOf' ])) {
defineProperty(
FunctionBuiltin,
'arityOf',
{
configurable: true,
writable: true,
value: polyfill,
});
}
if (!apply(hasOwnProperty, prototype, [ 'maxArity' ])) {
defineProperty(
prototype,

@@ -134,7 +145,7 @@ 'maxArity',

get() {
return arityOf(this).max;
return polyfill(this).max;
},
});
}
if (!hasOwnProperty(prototype, 'usesRest')) {
if (!apply(hasOwnProperty, prototype, [ 'usesRest' ])) {
defineProperty(

@@ -146,6 +157,7 @@ prototype,

get() {
return arityOf(this).usesRest;
return polyfill(this).usesRest;
},
});
}
// TODO: do we need to install on AsyncFunction, GeneratorFunction, etc.
};
{
"name": "arity-of",
"version": "1.0.1",
"version": "1.0.2",
"description": "Exposes max arity and other metadata for JS functions",

@@ -5,0 +5,0 @@ "main": "index.js",

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