
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
give-promise
Advanced tools
A simple wrapper around `Promise` providing a more human-friendly interface
A simple wrapper around Promise
providing a more human-friendly interface
Wraps this:
let resolve
let reject
const promise = new Promise((innerResolve, innerReject) => {
resolve = innerResolve;
reject = innerReject;
});
So that you can do this:
const givePromise = require('give-promise')
const [promise, resolve, reject] = givePromise()
Here you go:
import givePromise from 'give-promise/index.mjs'
If you use a module bundler like webpack
or rollup
, you can point 'give-promise'
to 'give-promise/index.mjs'
and then do this:
import givePromise from 'give-promise'
See your bundler's docs for how to setup that redirect, should be simple.
Personally, I don't like the default interface of Promise
. Needing to wrap my code inside a constructor just seems bad to me. I found myself doing the above extraction quite frequently and therefore decided to put that into a neat little helper.
With this, you can pass around the promise and its related resolve and reject functions quite easily and intuitively.
FAQs
A simple wrapper around `Promise` providing a more human-friendly interface
The npm package give-promise receives a total of 2 weekly downloads. As such, give-promise popularity was classified as not popular.
We found that give-promise demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.