
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@coffeekraken/s-promise
Advanced tools
As simple as a native Promise, this package extends it with events capabilities using the @coffeekraken/s-event-emitter one.
As simple as a native Promise, this package extends it with events capabilities using the @coffeekraken/s-event-emitter one.
npm i @coffeekraken/s-promise
This SPromise
class workds like a normal Promise
but add the SEventEmitter
capabilities like:
emit
: emitting eventson
: subscribe to eventspipe
: pipe events to another SEventEmitter
instanceHere's how to use our implementation:
import __SPromise from '@coffeekraken/s-promise';
function myInternalProcess() {
return new __SPromise(({ resolve, reject, emit }) => {
// emitting a log event
emit('log', {
value: 'Something cool',
});
resolve();
});
}
function myStartingProcess() {
return new __SPromise(async ({ resolve, reject, emit, pipe }) => {
// start internal process AND pipe his events higher
const promise = pipe(myInternalProcess());
// listen for logs. Can be any event name you want as well...
promise.on('log', (data, metas) => {
// do something with the logs...
});
// resolving the promise with our internal process one
resolve(promise);
});
}
const promise = myStartingProcess();
promise.on('log', () => {});
// etc...
Specify if a "cancel" event/call has to be treated like a "resolve", or like a "reject" a promise level
Specify after how many milliseconds the promise will be destroyed after a "finally" event
Specify if you prefer your promise to be "resolved" when an underlying error is catched, or if is has to be rejected normally
Specify if you want a "log" of type "error" to be emitted when an underlying error is catched
Specify if youw promise has to be resolved when catching a "resolve" event from deeper emitter
Specify if youw promise has to be rejected when catching a "reject" event from deeper emitter
Specify some functions to be called just before resolving the promise. This function will take the current promise resolve value and must return the updated value
Specify some functions to be called just before rejecting the promise. This function will take the current promise resolve value and must return the updated value
For more information about the API of this class, please check our API documentation
Distributed under the MIT License. See LICENSE for more information.
Here's all the ways you can contact us listed:
FAQs
As simple as a native Promise, this package extends it with events capabilities using the @coffeekraken/s-event-emitter one.
We found that @coffeekraken/s-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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.