
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
ts-command-invoker
Advanced tools
A simple command invoker, that can be used to implement undo/redo functionality (aka Ctrl+Z
/ Ctrl+Shift+Z
).
npm i ts-command-invoker
Command invoker can invoke commands and later undo or redo them. This can be useful for implementing classic undo/redo behavior such as the one you know from Google docs, etc.
import { Command, CommandInvoker } from 'ts-command-invoker';
let counter = 0;
export class AddOneCommand extends Command {
do(): void {
counter += 1;
}
undo(): void {
counter -= 1;
}
}
const invoker = new CommandInvoker();
invoker.invoke(new AddOneCommand());
// counter === 1
invoker.invoke(new AddOneCommand());
// counter === 2
invoker.undo()
// counter === 1
invoker.undo()
// counter === 0
invoker.redo()
// counter === 1
Multiple commands can be batched into one using MultiCommand
.
import { Command, CommandInvoker, MultiCommand } from 'ts-command-invoker';
export class DeleteCommand extends Command {
do(): void {
// delete one item
}
undo(): void {
// bring back one item
}
}
const deleteMultiple = new MultiCommand([
new DeleteCommand(item1),
new DeleteCommand(item2),
]);
const invoker = new CommandInvoker();
invoker.invoke(deleteMultiple);
Feel free to use in any way. (ISC)
FAQs
Command invoker for easy implementation of undo/redo
We found that ts-command-invoker 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.