npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rosinfo.tech/utils

v0.2.6

Published

[![rosinfo.tech](https://cdn.rosinfo.tech/id/logo/id_logo_width_160.svg "rosinfo.tech")](https://rosinfo.tech)

Readme

rosinfo.tech

@rosinfo.tech/utils

Installation

npm i @rosinfo.tech/utils

Usage

ES6:

import { arrayPushDistinct } from "@rosinfo.tech/utils/arrayPushDistinct";

// or
// import { arrayPushDistinct } from "@rosinfo.tech/utils";

// ...
arrayPushDistinct( [1, 2, 3], 1, 2, 3, 4, 5 ); // [1, 2, 3, 4, 5]
// ...

CommonJS:

const { arrayPushDistinct } = require( "@rosinfo.tech/utils/arrayPushDistinct" );

// or
// const { arrayPushDistinct } = require( "@rosinfo.tech/arrayPushDistinct" );

// ...
arrayPushDistinct( [1, 2, 3], 1, 2, 3, 4, 5 ); // [1, 2, 3, 4, 5]
// ...

Functions

export type TFunctionAnyParametersAnyReturn = (...args: Array<any>) => any;

export type TArguments<F extends TFunctionAnyParametersAnyReturn> = F extends (...args: infer A) => any ? A : never;

export interface IRGBA {
    a?: number;
    b: number;
    g: number;
    r: number;
}

export interface IHSL {
    h: number;
    l: number;
    s: number;
}

export interface IHSV {
    h: number;
    s: number;
    v: number;
}

export type TFLog = (...args: Array<unknown>) => TFLog;

export declare const ARRAY_INDEX_OF_NOT_FOUND = -1;

export declare const ARRAY_SORT_RETURN_CODE_EQUAL = 0;

export declare const ARRAY_SORT_RETURN_CODE_GREATER_THAN = 1;

export declare const ARRAY_SORT_RETURN_CODE_LESS_THAN = -1;

export declare const LOG_NEXT_AS_IS = "LOG_NEXT_AS_IS";

export declare const LOG_COLOR_BLACK_WHITE = "_blackWhite_";

export declare const LOG_COLOR_RED = "_red_";

export declare const LOG_COLOR_WHITE_RED = "_whiteRed_";

export declare const LOG_COLOR_YELLOW = "_yellow_";

export declare const LOG_COLOR_BLACK_YELLOW = "_blackYellow_";

export declare const LOG_COLOR_BLUE = "_blue_";

export declare const LOG_COLOR_WHITE_BLUE = "_whiteBlue_";

export declare const LOG_COLOR_GREEN = "_green_";

export declare const LOG_COLOR_BLACK_GREEN = "_blackGreen_";

export declare const CACHE_TIME_UNLIMITED = 0;

export declare const PARSE_INT_RADIX_10 = 10;

export declare const PARSE_INT_RADIX_16 = 16;

export declare const SCRIPT_PARSER_PAIRED_SYMBOLS_KEY_ALL = "0";

export declare const SCRIPT_PARSER_QUOTES_KEY_FLAT = "flat";

export declare const SCRIPT_PARSER_QUOTES_KEY_ALL = "0";

export declare const STRING_INDEX_OF_NOT_FOUND = -1;

export interface IErrorCode extends Error {
    details?: string;
}

export declare class ErrorCode extends Error {
    constructor(code: string, ...args: Array<any>);
    tryCatchLog(codeTryCatch: string): ErrorCode;
}

export declare const arrayDuplicatesExclude: <T extends any[]>(a: T) => T[];

export declare const arrayPushDistinct: <T extends any[]>(a: T, ...args: T) => T[];

export declare const arraySortNumberByValue: <T extends number>(a: T[]) => T[];

export declare const arraySortNumberByValueReverse: <T extends number>(a: T[]) => T[];

export declare const arraySortStringsByABC: <T extends string>(a: T[]) => T[];

export declare const arraySortStringsByABCReverse: <T extends string>(a: T[]) => T[];

export declare const arraySortStringsByLength: <T extends string>(a: T[]) => T[];

export declare const arraySortStringsByLengthReverse: <T extends string>(a: T[]) => T[];

export declare function cache<F extends TFunctionAnyParametersAnyReturn>(f: F, ...args: TArguments<F>): any;

export declare const RATIO_MICROSECONDS_TO_MILLISECONDS = 1000;

export declare const cacheStorage: Map<any, any>;

export declare function cacheTime<F extends TFunctionAnyParametersAnyReturn>(f: F, time?: number, ...args: TArguments<F>): any;

export declare function colorDarker(color: string, level: number): string;

export declare function colorDarkerToRGBA(color: string, level: number): IRGBA;

export declare function colorHEXAToRGBA(color: string): IRGBA;

export interface IColorHEXAStringToRGBAStringOptions {
    alpha?: number;
    color: string;
}

export declare function colorHEXAToRGBAString(options: IColorHEXAStringToRGBAStringOptions | string): string;

export declare function colorHSLToRGBA(options: IHSL): IRGBA;

export declare function colorHSVToRGBA(options: IHSV): IRGBA;

export declare function colorLighter(color: string, level: number): string;

export declare function colorLighterToRGBA(color: string, level: number): IRGBA;

export declare const REGEXP_RGBA: RegExp;

export declare function colorRGBAStringToRGBA(rgba: string): IRGBA;

export declare function colorRGBAToHEXA(options: IRGBA | string): string;

export declare function colorRGBAToHSL(options: IRGBA): IHSL;

export declare function colorRGBAToHSV(options: IRGBA): IHSV;

export interface IColorizeOptions {
    borders?: boolean;
    node?: HTMLElement | ChildNode;
    withNodesNested?: boolean;
}

export declare function colorize({ borders, node, withNodesNested }: IColorizeOptions): void;

export declare function debugLabelHas(label: string): boolean;

export declare function debugLevelGet(): number;

export declare const isArray: <T extends any[]>(value: unknown) => value is T;

export declare const isBoolean: (value: unknown) => value is boolean;

export declare const isError: (value: unknown) => value is Error;

export declare const isErrorCode: (value: unknown) => value is IErrorCode;

export declare const isFunction: (value: unknown) => value is Function;

export declare const isHTMLElement: (value: unknown) => value is HTMLElement;

export declare const isNode: (value: unknown) => value is Node;

export declare const isNull: (value: unknown) => value is null;

export declare const isNullOrUndefined: (value: unknown) => value is null | undefined;

export declare const isNumber: (value: unknown) => value is number;

export declare const isObjectType: (value: unknown) => boolean;

export declare const isObject: <T extends object>(value: unknown) => value is T;

export declare const isRegExp: (value: unknown) => value is RegExp;

export declare const isString: (value: unknown) => value is string;

export declare const isUndefined: (val: unknown) => val is undefined;

interface ILogState {
    nextAsIs?: boolean;
}

export declare const logState: ILogState;

export declare const colors: {
    _blackGreen_: import("cli-color/bare").Format;
    _blackWhite_: import("cli-color/bare").Format;
    _blackYellow_: import("cli-color/bare").Format;
    _blue_: import("cli-color/bare").Format;
    _default_: (_: string) => string;
    _green_: import("cli-color/bare").Format;
    _red_: import("cli-color/bare").Format;
    _whiteBlue_: import("cli-color/bare").Format;
    _yellow_: import("cli-color/bare").Format;
};

export declare const log: TFLog;

export declare const logBlue: TFLog;

export declare const logClear: () => Console;

export declare const logColorCheckLogNextAsIs: (color: any, arg: any) => boolean;

export declare const logError: TFLog;

export declare const logErrorBlue: TFLog;

export declare const logErrorColorCheckLogNextAsIs: (color: any, arg: any) => boolean;

export declare const logErrorGreen: TFLog;

export declare const logErrorRed: TFLog;

export declare const logErrorYellow: TFLog;

export declare const logGreen: TFLog;

export declare const logInfo: TFLog;

export declare const logRed: TFLog;

export declare const logSuccess: TFLog;

export declare const logWarning: TFLog;

export declare const logYellow: TFLog;

export declare function md5(...args: any[]): string;

export declare function memoize<F extends TFunctionAnyParametersAnyReturn>(fn: F, cacheTime?: number): F;

export declare function memoizeInvalidate<F extends TFunctionAnyParametersAnyReturn>(fn: F, cacheTime?: number): [F, (...args: TArguments<F>) => void, () => void];

export declare function numberOfValuesEqualTo<T>(values: Array<any>, equalTo: T): number;

export declare function numberRandom(min: number, max?: number): number;

export declare const objectClone: <T = any>(object: T) => T;

export declare const objectEmptyValuesDelete: (object: Record<string, unknown>) => Record<string, unknown>;

export declare const objectKeysSort: (object: Record<string, unknown>) => Record<string, unknown>;

interface IObjectMergeOptions {
    arrayClone?: boolean;
    arrayPushAll?: boolean;
    objectClone?: boolean;
}

export declare const objectMerge: <T = any>(objectA: T, objectB: Partial<T>, options?: IObjectMergeOptions) => T;

export declare function randomEnumValue<T extends object>(anEnum: T): T[keyof T];

type TScriptParserPairedSymbolsReturn = Map<number | string, Map<string, string>> | null;

export declare function scriptParserPairedSymbols(stack: string | Array<string>): TScriptParserPairedSymbolsReturn;

interface IScriptParserPositionDelimiterOptions {
    brackets: any;
    lines?: Array<string>;
    pathFile: string;
    startColumn: number;
    startLine: number;
    string?: string;
}

export declare function scriptParserPositionDelimiter({ brackets, lines: linesProperty, pathFile, startColumn, startLine, string, }: IScriptParserPositionDelimiterOptions): [number, number] | null;

type TScriptParserQuotesReturn = Map<number | string, Map<string, string>> | null;

export declare function scriptParserQuotes(stack: string | Array<string>): TScriptParserQuotesReturn;

export declare function scriptParserSingleSymbols(stack: string | Array<string>): Map<string | number, any> | null;

export declare function sleep(timeoutMs: number): Promise<void>;

export declare function sleepSync(ms: number): void;

interface IStringReplacePositionOptions {
    endColumn: number;
    endLine?: number;
    replaceTo?: string;
    startColumn?: number;
    startLine?: number;
    string: string;
}

export declare function stringReplacePositions({ endColumn, endLine, replaceTo, startColumn, startLine, string, }: IStringReplacePositionOptions): string;

export declare const stringReplaceWithKeyValue: (string: string, map: Record<string, unknown>, keysRegExp?: boolean) => string;

interface IStringSelectOptions {
    endColumn: number;
    endLine?: number;
    startColumn?: number;
    startLine?: number;
    string: string;
}

export declare function stringSelect({ endColumn, endLine, startColumn, startLine, string, }: IStringSelectOptions): string | null;

export declare const stringSingleLine: (string: string) => string;

export declare const stringTrimChars: (string: string, chars?: string) => string;

export declare const stringTrimLeftChars: (string: string, chars?: string) => string;

export declare const stringTrimRightChars: (string: string, chars?: string) => string;

export declare function svgToCssUrl(svg: string): string;

export declare function tryCatchLog(tryCatchCode: string, e: unknown): unknown;