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

bind-obj-methods

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bind-obj-methods - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

37

bind-obj-methods.js

@@ -13,29 +13,14 @@ 'use strict'

for (const k of Object.getOwnPropertyNames(proto)) {
if (bound[k]) {
continue
}
Object.keys(proto)
.filter(k => (typeof obj[k] === 'function' && !bound[k]))
.forEach(k => (bound[k] = true, obj[k] = proto[k].bind(obj)))
const descriptor = {...Object.getOwnPropertyDescriptor(proto, k)};
if ('value' in descriptor) {
if (typeof descriptor.value !== 'function') {
continue
}
descriptor.value = descriptor.value.bind(obj);
if (!descriptor.configurable) {
if (!descriptor.writable) {
continue;
}
obj[k] = descriptor.value;
bound[k] = true;
continue;
}
bound[k] = true;
Object.defineProperty(obj, k, descriptor)
}
}
Object.getOwnPropertyNames(proto)
.filter(k => (typeof obj[k] === 'function' && !bound[k]))
.forEach(k => (bound[k] = true, Object.defineProperty(obj, k, {
value: obj[k].bind(obj),
enumerable: false,
configurable: true,
writable: true
})))
}
{
"name": "bind-obj-methods",
"version": "2.0.1",
"version": "2.0.2",
"publishConfig": {
"tag": "v2-legacy"
},
"description": "Bind methods to an object from that object or some other source. Optionally specify a set of methods to skip over.",

@@ -24,8 +27,5 @@ "main": "bind-obj-methods.js",

"devDependencies": {
"tap": "^15.0.0-2"
"tap": "^10.7.0"
},
"engines": {
"node": ">=10"
},
"files": []
}
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