Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Number of Case Generator for TypeScript.
Symbol | Class |
---|---|
A x B x ... x Z | CartesianProduct |
n! | Factorial |
nPr | Permutation |
n∏r | RepeatedPermutation |
nHr | RepeatedCombination |
nCr | Combination |
npm install --save cagen
namespace cagen.base
{
export interface IForwardGenerator
{
// FREQUENCE ACCESSORS
size(): number;
begin(): Iterator;
end(): Iterator;
// ES2015, THEN FOR-OF ITERATION IS ALSO POSSIBLE
[Symbol.iterator]: IterableIterator<number[]>;
}
export interface Iterator
{
readonly value: number[];
next(): Iterator;
equals(obj: Iterator): boolean;
}
}
import { CartesianProduct } from "cagen";
function main(): void
{
let generator = new CartesianProduct(5, 4); // 5C4
console.log("n(5C4) =", generator.size());
for (let it = generator.begin(); !it.equals(generator.end()); it = it.next())
{
let aCase: number[] = it.value;
console.log(" -", aCase);
}
}
main();
for (let aCase of generator)
console.log(" -", aCase);
namespace cagen.base
{
export abstract class ArrayGenerator
implements IForwardGenerator<Iterator>
{
at(index: number): Array<number>;
}
}
Most of Case Generator classes, except combination classes, provide a random accessor at()
. By that method at()
, you can access to a specific case through not full iteration, but the special index number.
import { Permutation } from "cagen";
function main(): void
{
let generator = new Permutation(7, 3);
console.log( generator.at(13) );
console.log( generator.at(31) );
console.log( generator.at(9999) ); // throw an std.OutOfRange error.
}
main();
FAQs
Number of Cases Generator
The npm package cagen receives a total of 75 weekly downloads. As such, cagen popularity was classified as not popular.
We found that cagen 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 uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.