
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
@esmj/observable
Advanced tools
The @esmj/observable is a tiny, extensible observable library with TypeScript support.
npm install @esmj/observable
import { Observable, IObservable, IObserver } from '@esmj/observable';
// Object-style observer
const observer: IObserver = {
next(value) {
console.log('Received:', value);
},
error(err) {
console.error('Error:', err);
},
complete() {
console.log('Completed');
}
};
const observable: IObservable = new Observable();
// Subscribe and get subscription object
const subscription = observable.subscribe(observer);
// Emit values
observable.next('Hello world'); // log: Received: Hello world
// Unsubscribe
subscription.unsubscribe();
// Alternative: Function-style observer
const subscription2 = observable.subscribe((value) => {
console.log('Value:', value);
});
new Observable()Creates a new Observable instance.
pipe(...operations: ((observable) => observable)[])Extends the observable with custom operators. Returns a new observable with the applied operations.
Example:
const customObservable = observable.pipe(
(obs) => enhanceWithLogging(obs),
(obs) => addRetryLogic(obs)
);
next(...args: unknown[])Emits values to all subscribed observers.
Parameters:
args - Values to emit to observerserror(...args: unknown[])Notifies observers of an error and automatically unsubscribes them.
Parameters:
args - Error information to pass to observerscomplete(...args: unknown[])Signals completion to all observers and automatically unsubscribes them.
Parameters:
args - Completion values to pass to observerssubscribe(observer: IObserver): SubscriptionSubscribes an observer to receive notifications.
Parameters:
observer - Observer function or object with next, error, and complete methodsReturns: Subscription object with unsubscribe() method
Observer types:
// Function observer
(value) => void
// Object observer
{
next: (value) => void,
error?: (err) => void,
complete?: () => void
}
unsubscribe(observer: IObserver): voidManually removes an observer from the subscription list.
Parameters:
observer - The observer to unsubscribeMIT
FAQs
Tiny observable library for other extensibility
The npm package @esmj/observable receives a total of 41 weekly downloads. As such, @esmj/observable popularity was classified as not popular.
We found that @esmj/observable demonstrated a healthy version release cadence and project activity because the last version was released less than 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
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.