
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
cli-bespoke
Advanced tools
Parse and validate commandlines. Simple, well-typed and customizable.
No dependencies.
To parse any commandline, use parse()
(or parseLazy()
) and pass Converter
functions for each option.
type Converter<Input, Output> = (value: Input, sendError: ErrorSender) => Output;
The return type is determined by which Converter
you pass.
There are several built-in Converter
s, but you can also pass user-defined ones.
import {
parse,
flag,
first,
converters as cv,
converterFactories as cvf,
} from "cli-bespoke";
const args = parse({
// Arguments to parse.
args: process.argv.slice(2),
// Specify all options and their `Converter` functions.
convert: {
// Error if either undefined, zero or multiple values.
_: cv.justOne,
// No values. Parsed as boolean.
help: flag,
// Error if multiple values.
outfile: cv.optionalOne,
// Split strings, accepting undefined.
strs: cvf.optional(cvf.split(",")),
// A complex example including user-defined converter.
nums: first(cvf.zeroOrMore(cv.int)).then(cvf.map((n) => n + 1)),
},
// Option names and their aliases (not required).
alias: {
// -h will be parsed as --help
help: "h",
},
});
The result will be typed as follows:
const args: {
_: string;
help: boolean;
outfile: string | undefined;
strs: string[] | undefined;
nums: number[]
}
Details about convert
:
_
is for parameters that do not belong to any options.flag
for options that do not receive values.readonly string[] | undefined
before converting.converters
provides built-in Converter
s.converterFactories
provieds functions that produces Converter
s.first()
/then()
for chaining multiple Converter
s.You can replace any field of config
.
import { config } from "cli-bespoke";
config.onError = (err) => {
console.error(err);
process.exit(1);
};
FAQs
Parse and validate commandlines. Simple, well-typed and customizable.
The npm package cli-bespoke receives a total of 2 weekly downloads. As such, cli-bespoke popularity was classified as not popular.
We found that cli-bespoke 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.