helper-fns
Advanced tools
Comparing version 2.6.17 to 2.6.18
@@ -0,23 +1,35 @@ | ||
import * as timers_promises from 'timers/promises'; | ||
import { Buffer } from 'node:buffer'; | ||
declare function union<T = unknown>(a: T[], b: T[], duplicates?: boolean): T[]; | ||
declare function difference<T = unknown>(a: T[], b: T[]): T[]; | ||
declare function common<T = unknown>(a: T[], b: T[]): T[]; | ||
declare function flattenDeep(array: unknown[]): unknown[]; | ||
declare function unique<T = unknown>(values: Iterable<T>): Iterable<T>; | ||
declare function sumOfAnArray(array: number[], initialValue?: number): number; | ||
declare function dropRight<T = unknown>(array: T[], n?: number): T[]; | ||
declare function intersection(a: unknown[], b: unknown[]): unknown[]; | ||
declare function dropWhile<T>(array: T[], function_: (argument: T) => boolean): T[]; | ||
declare const castArray: <T>(value: T | T[]) => T[]; | ||
declare const chunk: <T = unknown>(array: T[], size: number) => T[][]; | ||
declare const common: <T = unknown>(a: T[], b: T[]) => T[]; | ||
declare const compact: <T>(array: T[]) => T[]; | ||
declare const difference: <T = unknown>(a: T[], b: T[]) => T[]; | ||
declare const drop: <T = unknown>(array: string | T[], n?: number) => string | T[]; | ||
declare function shuffle<T>(array: T[]): T[]; | ||
declare function move<T>(array: T[], from: number, to: number): T[]; | ||
declare function sample<T>(array: T[], quantity: number): T[]; | ||
declare const dropWhile: <T>(array: T[], const_: (argument: T) => boolean) => T[]; | ||
declare const dropRight: <T = unknown>(array: T[], n?: number) => T[]; | ||
declare const equals: <T = unknown>(a: T[], b: T[]) => boolean; | ||
declare const equalsIgnoreOrder: <T>(a: T[], b: T[]) => boolean; | ||
declare const hasDuplicates: <T>(a: T[]) => boolean; | ||
declare const fill: <T = unknown>(array: T[], value: T, start?: number, end?: number) => T[]; | ||
declare const flattenDeep: (array: unknown[]) => unknown[]; | ||
declare const intersection: (a: unknown[], b: unknown[]) => unknown[]; | ||
declare const move: <T>(array: T[], from: number, to: number) => T[]; | ||
declare const sample: <T>(array: T[], quantity: number) => T[]; | ||
declare const shuffle: <T>(array: T[]) => T[]; | ||
declare const sumOfAnArray: (array: number[], initialValue?: number) => number; | ||
declare const unique: <T = unknown>(values: Iterable<T>) => Iterable<T>; | ||
declare const union: <T = unknown>(a: T[], b: T[], duplicates?: boolean) => T[]; | ||
declare const range: (length: number) => number[]; | ||
declare function assert(condition: boolean, message: string): asserts condition; | ||
declare const assert: (condition: boolean, message: string) => asserts condition; | ||
declare const noop: () => void; | ||
declare const toString: (v: any) => string; | ||
declare function noop(): void; | ||
type Arrayable<T> = T | T[]; | ||
type Awaitable<T> = T | PromiseLike<T>; | ||
type Class<T = unknown, Arguments extends any[] = any[]> = new (...arguments_: Arguments) => T; | ||
type Primitive = null | undefined | string | number | boolean | symbol | bigint; | ||
type Constructor<T, Arguments extends unknown[] = any[]> = new (...arguments_: Arguments) => T; | ||
type FunctionType<T = void> = (...arguments_: any) => T; | ||
type Maybe<T> = T | null; | ||
@@ -28,15 +40,4 @@ type Nullable<T> = T | null; | ||
}; | ||
type Constructor<T, Arguments extends unknown[] = any[]> = new (...arguments_: Arguments) => T; | ||
type FunctionType<T = void> = (...arguments_: any) => T; | ||
type Arrayable<T> = T | T[]; | ||
type Awaitable<T> = T | PromiseLike<T>; | ||
type Primitive = null | undefined | string | number | boolean | symbol | bigint; | ||
interface ISlugifyOptions { | ||
separator?: string; | ||
} | ||
interface IRandomStringOptions { | ||
length: number; | ||
symbols?: boolean; | ||
numbers?: boolean; | ||
} | ||
interface IDebounceOptions { | ||
@@ -54,67 +55,83 @@ func: FunctionType; | ||
} | ||
interface IRandomStringOptions { | ||
length: number; | ||
symbols?: boolean; | ||
numbers?: boolean; | ||
} | ||
interface ISlugifyOptions { | ||
separator?: string; | ||
} | ||
declare const autoParseValues: (value: string) => any; | ||
declare const awaitTimeout: typeof timers_promises.setTimeout; | ||
declare const composeAsync: (...fns: unknown[]) => (input: any) => Promise<any>; | ||
declare const clamp: (value: number, min: number, max: number) => number; | ||
declare const debounce: (options: IDebounceOptions) => (this: any, ...arguments_: any[]) => void; | ||
declare const decrypt: (options: IEncryptOptions) => string; | ||
declare const delay: (time: number) => Promise<unknown>; | ||
declare const encrypt: (options: IEncryptOptions) => string; | ||
declare const fixedDecimal: (number_: number, fixed?: number) => number; | ||
declare const formatDuration: (ms: number) => string; | ||
declare const inRange: (number_: number, a: number, b?: number) => boolean; | ||
declare const isDate: (dateString: string) => boolean; | ||
declare function isEmpty(object: { | ||
[s: string]: unknown; | ||
} | ArrayLike<unknown>): boolean; | ||
declare function resolverArgs(...arguments_: any[]): string; | ||
declare const isSameDate: (dateA: Date, dateB: Date) => boolean; | ||
declare const lerp: (ratio: number, start: number, end: number) => number; | ||
declare function pipe<T>(...fns: ((input: T) => T)[]): (input: T) => T; | ||
declare const readFile: (path: string) => Promise<string>; | ||
declare const resolverArguments: (...arguments_: any[]) => string; | ||
declare const timestamp: () => number; | ||
declare function pipe<T>(...fns: ((input: T) => T)[]): (input: T) => T; | ||
declare function fixedDecimal(number_: number, fixed?: number): number; | ||
declare function autoParseValues(value: string): any; | ||
declare function debounce(options: IDebounceOptions): (this: any, ...arguments_: any[]) => void; | ||
declare function timeTaken<T>(callback: () => T): [T, number]; | ||
declare function formatDuration(ms: number): string; | ||
declare function isDate(dateString: string): boolean; | ||
declare function encrypt(options: IEncryptOptions): string; | ||
declare function decrypt(options: IEncryptOptions): string; | ||
declare function readFile(path: string): Promise<string>; | ||
declare function composeAsync(...fns: unknown[]): (input: any) => Promise<any>; | ||
declare function isSameDate(dateA: Date, dateB: Date): boolean; | ||
declare function delay(time: number): Promise<unknown>; | ||
declare function throttler(_request: any, _response: any, next: () => void): NodeJS.Timeout | undefined; | ||
declare function removeNull(object: Record<string, any>): Record<string, any>; | ||
declare function removeUndefined<T extends Record<string, any>>(object: T): T; | ||
declare function pick<T, K extends keyof T>(object: T, keys: K[]): Pick<T, K>; | ||
declare function omit<T extends object, K extends keyof T>(object: T, keys: K[]): Omit<T, K>; | ||
declare function orderBy<T extends object, K extends keyof T>(array: T[], properties: K[], orders: Map<number, "asc" | "desc">): void; | ||
declare function renameKeys(keysMap: Record<string, any>, object: Record<string, any>): void; | ||
declare function pluck<T, K extends keyof T>(array: T[], key: K): T[K][]; | ||
declare function objectArrayToArray<T>(objectArray: T[], attribute: keyof T): T[keyof T][]; | ||
declare function enumToString<T extends Record<string, string>>(_enum: T): string; | ||
declare function copyObject(instance: object): object; | ||
declare function groupBy(array: any[], property: string): Record<string, any[]>; | ||
declare function invertObject(object: Record<string, any>): Record<string, any>; | ||
declare function isKeyOf<T extends object>(object: T, k: keyof any): k is keyof T; | ||
declare const copyObject: (instance: object) => object; | ||
declare const enumToString: <T extends Record<string, string>>(_enum: T) => string; | ||
declare const groupBy: (array: any[], property: string) => Record<string, any[]>; | ||
declare const invertObject: (object: Record<string, any>) => Record<string, any>; | ||
declare const isKeyOf: <T extends object>(object: T, k: keyof any) => k is keyof T; | ||
declare const objectArrayToArray: <T>(objectArray: T[], attribute: keyof T) => T[keyof T][]; | ||
declare const omit: <T extends object, K extends keyof T>(object: T, keys: K[]) => Omit<T, K>; | ||
declare const pick: <T, K extends keyof T>(object: T, keys: K[]) => Pick<T, K>; | ||
declare const pluck: <T, K extends keyof T>(array: T[], key: K) => T[K][]; | ||
declare const orderBy: <T extends object, K extends keyof T>(array: T[], properties: K[], orders: "asc" | "desc") => void; | ||
declare const removeNull: (object: Record<string, any>) => Record<string, any>; | ||
declare const removeUndefined: <T extends Record<string, any>>(object: T) => T; | ||
declare const renameKeys: (keysMap: Record<string, any>, object: Record<string, any>) => Record<string, any>; | ||
declare function chop(string_: unknown): string; | ||
declare function capitalize(string_: string): string; | ||
declare function unescapeHTML(string_: string): string; | ||
declare function capitalizeEveryWord(string_: string): string; | ||
declare function lowerFirst(string_: string): string; | ||
declare function randomHex(size: number): string; | ||
declare function stringAfter(string_: string, substr: string): string; | ||
declare function stringBefore(string_: string, substr: string): string; | ||
declare function normalizeEmail(email: string): string; | ||
declare function ensureSuffix(suffix: string, string_: string): string; | ||
declare function randomNumber(a?: number, b?: number): number; | ||
declare function slugify(string_: string, options?: ISlugifyOptions): string; | ||
declare function ensurePrefix(prefix: string, string_: string): string; | ||
declare function stringifyQueryParameters(parameters?: Record<string, any> | string): string; | ||
declare function template(string_: string, mix: Record<string, any>): string; | ||
declare function randomString(options: IRandomStringOptions): string; | ||
declare function slash(string_: string): string; | ||
declare function orderedToken(string_: string, identifier?: string): string; | ||
declare const capitalizeEveryWord: (string_: string) => string; | ||
declare const capitalize: (string_: string) => string; | ||
declare const chop: (string_: unknown) => string; | ||
declare const ensureSuffix: (suffix: string, string_: string) => string; | ||
declare const ensurePrefix: (prefix: string, string_: string) => string; | ||
declare const lowerFirst: (string_: string) => string; | ||
declare const normalizeEmail: (email: string) => string; | ||
declare const orderedToken: (string_: string, identifier?: string) => string; | ||
declare const randomHex: (size: number) => string; | ||
declare const randomString: (options: IRandomStringOptions) => string; | ||
declare const randomNumber: (a?: number, b?: number) => number; | ||
declare const stringAfter: (string_: string, substr: string) => string; | ||
declare const stringBefore: (string_: string, substr: string) => string; | ||
declare const slugify: (string_: string, options?: ISlugifyOptions) => string; | ||
declare const slash: (string_: string) => string; | ||
declare const stringifyQueryParameters: (parameters?: Record<string, any> | string) => string; | ||
declare const template: (string_: string, mix: Record<string, any>) => string; | ||
declare const unescapeHTML: (string_: string) => string; | ||
declare const uncapitalize: ([first, ...rest]: string[], upperRest?: boolean) => string; | ||
declare function isDefined<T = any>(value?: T): value is T; | ||
declare function isArray<T>(value: unknown): value is T[]; | ||
declare function isBigint(value: unknown): value is bigint; | ||
declare const isBoolean: (value: any) => value is boolean; | ||
declare function isBuffer(value: unknown): value is Buffer; | ||
declare function isClass(value: unknown): value is Class; | ||
declare function isFunction<T extends FunctionType>(value: any): value is T; | ||
declare function isNonPrimitive(x?: unknown): x is object; | ||
declare const isNumber: (value: any) => value is number; | ||
declare const isNull: (value: unknown) => value is null; | ||
declare function isObject(value: any): value is object; | ||
declare function isPrimitive(value?: unknown): value is Primitive; | ||
declare function isString(value: unknown): value is string; | ||
declare function isObject(value: any): value is object; | ||
declare const isNull: (value: unknown) => value is null; | ||
declare function isArray<T>(value: unknown): value is T[]; | ||
declare function isBigint(value: unknown): value is bigint; | ||
declare function isBuffer(value: unknown): value is Buffer; | ||
declare function isClass(value: unknown): value is Class; | ||
declare function isSymbol(value: unknown): value is symbol; | ||
declare const isUndefined: (value: unknown) => value is undefined; | ||
declare function isRegExp(value: any): value is RegExp; | ||
@@ -124,7 +141,8 @@ declare const is: { | ||
isBoolean: (value: any) => value is boolean; | ||
isDefined: typeof isDefined; | ||
isFunction: typeof isFunction; | ||
isNull: (value: unknown) => value is null; | ||
isNumber: (value: any) => value is number; | ||
isUndefined: (value: unknown) => value is undefined; | ||
isObject: typeof isObject; | ||
isSymbol: typeof isSymbol; | ||
isString: typeof isString; | ||
@@ -134,8 +152,10 @@ isBigint: typeof isBigint; | ||
isClass: typeof isClass; | ||
isDate: typeof isDate; | ||
isPrimitive: typeof isPrimitive; | ||
isNonPrimitive: typeof isNonPrimitive; | ||
isDate: (dateString: string) => boolean; | ||
isEmpty: typeof isEmpty; | ||
isSameDate: typeof isSameDate; | ||
isSameDate: (dateA: Date, dateB: Date) => boolean; | ||
isRegExp: typeof isRegExp; | ||
}; | ||
export { Arrayable, Awaitable, Class, Constructor, FunctionType, IDebounceOptions, IEncryptOptions, IRandomStringOptions, ISlugifyOptions, Maybe, Nullable, OptionalRecord, Primitive, assert, autoParseValues, capitalize, capitalizeEveryWord, chop, common, composeAsync, copyObject, debounce, decrypt, delay, difference, drop, dropRight, dropWhile, encrypt, ensurePrefix, ensureSuffix, enumToString, fixedDecimal, flattenDeep, formatDuration, groupBy, intersection, invertObject, is, isArray, isBigint, isBoolean, isBuffer, isClass, isDate, isDefined, isEmpty, isFunction, isKeyOf, isNull, isNumber, isObject, isRegExp, isSameDate, isString, lowerFirst, move, noop, normalizeEmail, objectArrayToArray, omit, orderBy, orderedToken, pick, pipe, pluck, randomHex, randomNumber, randomString, readFile, removeNull, removeUndefined, renameKeys, resolverArgs, sample, shuffle, slash, slugify, stringAfter, stringBefore, stringifyQueryParameters, sumOfAnArray, template, throttler, timeTaken, timestamp, toString, unescapeHTML, union, unique }; | ||
export { type Arrayable, type Awaitable, type Class, type Constructor, type FunctionType, type IDebounceOptions, type IEncryptOptions, type IRandomStringOptions, type ISlugifyOptions, type Maybe, type Nullable, type OptionalRecord, type Primitive, assert, autoParseValues, awaitTimeout, capitalize, capitalizeEveryWord, castArray, chop, chunk, clamp, common, compact, composeAsync, copyObject, debounce, decrypt, delay, difference, drop, dropRight, dropWhile, encrypt, ensurePrefix, ensureSuffix, enumToString, equals, equalsIgnoreOrder, fill, fixedDecimal, flattenDeep, formatDuration, groupBy, hasDuplicates, inRange, intersection, invertObject, is, isArray, isBigint, isBoolean, isBuffer, isClass, isDate, isEmpty, isFunction, isKeyOf, isNonPrimitive, isNull, isNumber, isObject, isPrimitive, isRegExp, isSameDate, isString, isSymbol, isUndefined, lerp, lowerFirst, move, noop, normalizeEmail, objectArrayToArray, omit, orderBy, orderedToken, pick, pipe, pluck, randomHex, randomNumber, randomString, range, readFile, removeNull, removeUndefined, renameKeys, resolverArguments, sample, shuffle, slash, slugify, stringAfter, stringBefore, stringifyQueryParameters, sumOfAnArray, template, throttler, timeTaken, timestamp, toString, uncapitalize, unescapeHTML, union, unique }; |
{ | ||
"name": "helper-fns", | ||
"type": "module", | ||
"version": "2.6.17", | ||
"version": "2.6.18", | ||
"packageManager": "pnpm@8.7.1", | ||
@@ -15,17 +15,13 @@ "description": "Some common utilities functions for everyday backend usage with zero dependencies", | ||
"bugs": "https://github.com/rubiin/helper-fns/issues", | ||
"exports": { | ||
".": { | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.cjs" | ||
} | ||
}, | ||
"main": "./dist/index.cjs", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"./dist/*", | ||
"./dist/index.d.ts" | ||
] | ||
} | ||
}, | ||
"files": [ | ||
"dist", | ||
"*.d.ts" | ||
"dist" | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
53663
7
223
2
1