Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
bind-property-descriptor
Advanced tools
Bind a property descriptor (value, getter and setter).
Installation of the npm package:
> npm install --save bind-property-descriptor
This test data will be used for the examples:
const emma = {
firstName: 'Emma',
lastName: 'Russel',
get fullName () {
return `${this.firstName} ${this.lastName}`
}
}
bindPropertyDescriptor(descriptor, thisArg) → boundDescriptor
Creates a new property descriptor bound to an object.
The value (if a function), getter and/or setter will be called with the bound object.
import { bindPropertyDescriptor } from 'bind-property-descriptor'
const obj = {}
const descriptor = Object.getOwnPropertyDescriptor(emma, 'fullName')
const boundDescriptor = bindPropertyDescriptor(descriptor, emma)
Object.defineProperty(obj, 'fullName', boundDescriptor)
obj.fullName
// → Emma Russel
getBoundPropertyDescriptor(obj, prop, thisArg = obj) → boundDescriptor
Because it's a common case to first get the descriptor and then bind it, this helper is provided.
import { getBoundPropertyDescriptor } from 'bind-property-descriptor'
const obj = {}
const boundDescriptor = getBoundPropertyDescriptor(emma, 'fullName')
Object.defineProperty(obj, 'fullName', boundDescriptor)
obj.fullName
// → Emma Russel
Contributions are very welcomed, either on the documentation or on the code.
You may:
ISC © Julien Fontanet
FAQs
bind a property descriptor (value, getter and setter)
The npm package bind-property-descriptor receives a total of 428 weekly downloads. As such, bind-property-descriptor popularity was classified as not popular.
We found that bind-property-descriptor demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.