New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

moderndash

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

moderndash - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

src/function/times.ts

223

dist/index.d.ts

@@ -17,8 +17,13 @@ /**

type MinimumTwoArrays<T> = [T[], T[], ...T[][]];
type MinimumTwoArrays<TInput> = [TInput[], TInput[], ...TInput[][]];
type IterateeFunction<T> = (value: T) => unknown;
type PropertyShorthand<T> = keyof T;
type RecordKey = string | number | symbol;
type ArrayOrRecord<T> = T[] | Record<RecordKey, T>;
type ArrayOrRecord<TInput> = TInput[] | Record<RecordKey, TInput>;
type NoUnion<T, U = T> = T extends U ? [U] extends [T] ? T : never : never;
/**
* @description Generic function type, should fit any function
* @typeParam TFunc - The input function type
*/
type GenericFunction<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>> = (...args: Parameters<TFunc>) => ReturnType<TFunc>;

@@ -35,5 +40,5 @@ /**

* difference([2, 1], [2, 3])
* // =\> [1]
* // => [1]
*/
declare function difference<T>(...arrays: MinimumTwoArrays<T>): T[];
declare function difference<TInput>(...arrays: MinimumTwoArrays<TInput>): TInput[];

@@ -256,50 +261,2 @@ /**

/**
* Creates an array of unique values, in order, from all given arrays using for equality comparisons.
*
* @category Array
* @param arrays - The arrays to inspect.
* @returns Returns the new array of combined values.
* @example
* union([2, 3], [1, 2])
* // => [2, 3, 1]
*/
declare function union<TInput>(...arrays: MinimumTwoArrays<TInput>): TInput[];
/**
* This method is like `union` except that it accepts `iteratee` which is
* invoked for each element of each `arrays` to generate the criterion by
* which uniqueness is computed. Result values are chosen from the first
* array in which the value occurs. The iteratee is invoked with one argument:
* (value).
*
* @category Array
* @param arrays - The arrays to inspect.
* @param iteratee - The iteratee invoked per element. Or property shorthand.
* @returns Returns the new array of combined values.
* @example
* unionBy(Math.floor, [2.1], [1.2, 2.3])
* // => [2.1, 1.2]
*/
declare function unionBy<T>(iteratee: IterateeFunction<T> | PropertyShorthand<T>, ...arrays: MinimumTwoArrays<T>): T[];
/**
* This method is like `union` except that it accepts `comparator` which
* is invoked to compare elements of `arrays`. Result values are chosen from
* the first array in which the value occurs. The comparator is invoked
* with two arguments: (arrVal, othVal).
*
* @category Array
* @param comparator - The comparator invoked per element.
* @param arrays - The arrays to inspect.
* @returns Returns the new array of combined values.
* @example
* const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
* const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]
*
* unionWith(isEqual, objects, others)
* // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
*/
declare function unionWith<TInput>(comparator: (a: TInput, b: TInput) => boolean, ...arrays: MinimumTwoArrays<TInput>): TInput[];
/**
* Creates a duplicate-free version of an array, in which only the first occurrence of each element is kept.

@@ -462,12 +419,15 @@ * The order of result values is determined by the order they occur in the array.

* @example
* const caution = () => alert("Caution!");
* const caution = () => console.log("Caution!");
*
* // Display alert only after it has been called 5 times
* after(5, caution)
* const afterFN = after(2, caution);
*
* afterFN()
* afterFN()
* afterFN()
* // => `caution` is invoked after called twice
*/
declare function after<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(n: number, func: TFunc): (...args: Parameters<TFunc>) => ReturnType<TFunc> | undefined;
declare function after<TFunc extends GenericFunction<TFunc>>(n: number, func: TFunc): (...args: Parameters<TFunc>) => ReturnType<TFunc> | undefined;
/**
* Creates a function that invokes `func`, with the `this` binding and arguments
* of the created function, while it's called less than `n` times. Subsequent
* Creates a function that invokes `func`, while it's called less than `n` times. Subsequent
* calls to the created function return the result of the last `func` invocation.

@@ -480,16 +440,20 @@ *

* @example
* const caution = () => alert("Caution!");
* const caution = () => console.log("Caution!");
*
* // Only call caution two times
* before(2, caution)
* const reducedCaution = before(2, caution)
*
* reducedCaution()
* reducedCaution()
* reducedCaution()
* // => `caution` is invoked twice
*/
declare function before<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(n: number, func: TFunc): TFunc;
declare function debounce<T extends (...args: Parameters<T>) => ReturnType<T>>(fn: T, wait?: number, options?: {
declare function debounce<TFunc extends GenericFunction<TFunc>>(fn: TFunc, wait?: number, options?: {
leading?: boolean;
maxWait?: number;
trailing?: boolean;
}): (this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T>;
}): (this: ThisParameterType<TFunc>, ...args: Parameters<TFunc>) => ReturnType<TFunc>;
type Cache = Map<string | symbol, unknown>;
/**

@@ -510,2 +474,4 @@ * Creates a function that memoizes the result of `func`. If `resolver` is

* @param resolver - The function to resolve the cache key.
* @typeParam TFunc - The input function type
* @typeParam Cache - The cache map type
* @returns Returns the new memoized function.

@@ -534,18 +500,135 @@ * @example

*/
declare function memoize<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(func: TFunc, resolver?: ((...args: Parameters<TFunc>) => string | symbol)): TFunc & {
declare function memoize<TFunc extends GenericFunction<TFunc>, Cache extends Map<string | symbol, ReturnType<TFunc>>>(func: TFunc, resolver?: ((...args: Parameters<TFunc>) => string | symbol)): TFunc & {
cache: Cache;
};
declare function once<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(func: TFunc): TFunc;
/**
* Creates a function that is restricted to invoking `func` once. Repeat calls
* to the function return the value of the first invocation. The `func` is
* invoked with the `this` binding and arguments of the created function.
*
* @category Function
* @param func - The function to restrict.
* @returns Returns the new restricted function.
* @example
* const initialize = once(() => console.log('initialize'))
* initialize()
* initialize()
* // => `createApplication` is invoked once
*/
declare function once<TFunc extends GenericFunction<TFunc>>(func: TFunc): TFunc;
declare function throttle<T extends (...args: Parameters<T>) => ReturnType<T>>(func: T, wait?: number, options?: {
declare function throttle<TFunc extends GenericFunction<TFunc>>(func: TFunc, wait?: number, options?: {
leading?: boolean;
trailing?: boolean;
}): (this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T>;
}): (this: ThisParameterType<TFunc>, ...args: Parameters<TFunc>) => ReturnType<TFunc>;
declare function isEmpty(value: unknown): boolean;
/**
* Invokes the iteratee `n` times, returning an array of the results of
* each invocation. The function is invoked with one argument: (index).
*
* @category Function
* @param n - The number of times to invoke `func`.
* @param iteratee - The function invoked per iteration.
* @returns Returns the array of results.
* @example
* times(3, index => console.log("Run", index)))
* // => "Run 0" | "Run 1" | "Run 2"
*
* times(3, Math.random)
* // => [0.123, 0.456, 0.789]
*
* times(4, () => 0)
* // => [0, 0, 0, 0]
*/
declare function times<T>(n: number, func: (index: number) => T): T[];
/**
* Checks if `value` is an empty object, collection, map, or set.
*
* Objects are considered empty if they have no own enumerable string keyed
* properties.
*
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
*
* @category Lang
* @param value - The value to check.
* @returns Returns `true` if `value` is empty, else `false`.
* @example
* isEmpty(null)
* // => true
*
* isEmpty({})
* // => true
*
* isEmpty("")
* // => true
*
* isEmpty([1, 2, 3])
* // => false
*
* isEmpty('abc')
* // => false
*
* isEmpty({ 'a': 1 })
* // => false
*/
declare function isEmpty(value: string | object | null | undefined): boolean;
/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
*
* **Note:** This method supports comparing arrays, array buffers, booleans,
* date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM
* nodes are compared by strict equality, i.e. `===`.
*
* @category Lang
* @param value1 - The value to compare.
* @param value2 - The other value to compare.
* @returns Returns `true` if the values are equivalent, else `false`.
* @example
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
*
* object === other;
* // => false
*/
declare function isEqual(value1: unknown, value2: unknown): boolean;
declare function isEqualWith<T>(customizer: (value: T) => unknown, a: T, b: T): boolean;
/**
* This method is like `_.isEqual` except that it accepts `customizer` which
* is invoked to compare values. If `customizer` returns `undefined`, comparisons
* are handled by the method instead. The `customizer` is invoked with up to
* six arguments: (objValue, othValue [, index|key, object, other, stack]).
*
* @category Lang
* @param value1 - The value to compare.
* @param value2 - The other value to compare.
* @param customizer - The function to customize comparisons.
* @returns Returns `true` if the values are equivalent, else `false`.
* @example
* function isGreeting(value) {
* return /^h(?:i|ello)$/.test(value);
* }
*
* function customizer(objValue, othValue) {
* if (isGreeting(objValue) && isGreeting(othValue)) {
* return true;
* }
* }
*
* var array = ['hello', 'goodbye'];
* var other = ['hi', 'goodbye'];
*
* isEqualWith(array, other, customizer);
* // => true
*/
declare function isEqualWith<T>(a: T, b: T, customizer: (value: T) => unknown): boolean;

@@ -592,2 +675,2 @@ declare function isPlainObject(value: unknown): value is object;

export { ArrayOrRecord, IterateeFunction, MinimumTwoArrays, NoUnion, PropertyShorthand, RecordKey, after, before, camelCase, capitalize, chunk, countBy, debounce, deburr, difference, differenceBy, differenceWith, dropRightWhile, dropWhile, escape, escapeRegExp, groupBy, intersection, intersectionBy, intersectionWith, isEmpty, isEqual, isEqualWith, isPlainObject, kebabCase, memoize, once, pascalCase, pick, sample, sampleSize, shuffle, snakeCase, sortBy, startCase, stripSpecialChars, takeRightWhile, takeWhile, throttle, unescapeHTML, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, zip, zipWith };
export { ArrayOrRecord, GenericFunction, IterateeFunction, MinimumTwoArrays, NoUnion, PropertyShorthand, RecordKey, after, before, camelCase, capitalize, chunk, countBy, debounce, deburr, difference, differenceBy, differenceWith, dropRightWhile, dropWhile, escape, escapeRegExp, groupBy, intersection, intersectionBy, intersectionWith, isEmpty, isEqual, isEqualWith, isPlainObject, kebabCase, memoize, once, pascalCase, pick, sample, sampleSize, shuffle, snakeCase, sortBy, startCase, stripSpecialChars, takeRightWhile, takeWhile, throttle, times, unescapeHTML, uniq, uniqBy, uniqWith, unzip, unzipWith, zip, zipWith };

@@ -92,3 +92,3 @@ // src/array/chunk.ts

// src/lang/isEqualWith.ts
function isEqualWith(customizer, a, b) {
function isEqualWith(a, b, customizer) {
return isEqual(customizer(a), customizer(b));

@@ -100,3 +100,3 @@ }

const iterateeFunction = getIterateFunction(iteratee);
return differenceWith((a, b) => isEqualWith(iterateeFunction, a, b), ...arrays);
return differenceWith((a, b) => isEqualWith(a, b, iterateeFunction), ...arrays);
}

@@ -139,3 +139,3 @@

const iterateeFunction = getIterateFunction(iteratee);
return intersectionWith((a, b) => isEqualWith(iterateeFunction, a, b), ...arrays);
return intersectionWith((a, b) => isEqualWith(a, b, iterateeFunction), ...arrays);
}

@@ -206,26 +206,2 @@

// src/array/union.ts
function union(...arrays) {
return [...new Set(arrays.flat())];
}
// src/array/unionWith.ts
function unionWith(comparator, ...arrays) {
return arrays.reduce((acc, current) => {
for (const item of current) {
if (acc.some((x) => comparator(x, item))) {
continue;
}
acc.push(item);
}
return acc;
}, []);
}
// src/array/unionBy.ts
function unionBy(iteratee, ...arrays) {
const iterateeFunction = getIterateFunction(iteratee);
return unionWith((a, b) => isEqualWith(iterateeFunction, a, b), ...arrays);
}
// src/array/uniqWith.ts

@@ -469,2 +445,11 @@ function uniqWith(comparator, array) {

// src/function/times.ts
function times(n, func) {
const result = [];
for (let i = 0; i < n; i++) {
result.push(func(i));
}
return result;
}
// src/lang/isEmpty.ts

@@ -478,5 +463,2 @@ function isEmpty(value) {

}
if (typeof value === "number") {
return false;
}
if (value instanceof Map || value instanceof Set) {

@@ -652,6 +634,4 @@ return value.size === 0;

throttle,
times,
unescapeHTML,
union,
unionBy,
unionWith,
uniq,

@@ -658,0 +638,0 @@ uniqBy,

{
"name": "moderndash",
"version": "0.0.10",
"version": "0.0.11",
"type": "module",

@@ -5,0 +5,0 @@ "description": "A lodash inspired utility framework for ESM/Typescript/ES2020",

@@ -16,7 +16,7 @@ import type { MinimumTwoArrays } from '../types';

* difference([2, 1], [2, 3])
* // =\> [1]
* // => [1]
*/
export function difference<T>(...arrays: MinimumTwoArrays<T>): T[] {
export function difference<TInput>(...arrays: MinimumTwoArrays<TInput>): TInput[] {
return differenceWith(isEqual, ...arrays);
}

@@ -29,3 +29,3 @@ import type { IterateeFunction, MinimumTwoArrays, PropertyShorthand } from '../types';

const iterateeFunction = getIterateFunction(iteratee);
return differenceWith((a, b) => isEqualWith(iterateeFunction, a, b), ...arrays);
return differenceWith((a, b) => isEqualWith(a, b, iterateeFunction), ...arrays);
}

@@ -15,5 +15,2 @@ export * from './chunk';

export * from './takeWhile';
export * from './union';
export * from './unionBy';
export * from './unionWith';
export * from './uniq';

@@ -20,0 +17,0 @@ export * from './uniqBy';

@@ -25,3 +25,3 @@ import type { IterateeFunction, MinimumTwoArrays, PropertyShorthand } from '../types';

const iterateeFunction = getIterateFunction(iteratee);
return intersectionWith((a, b) => isEqualWith(iterateeFunction, a, b), ...arrays);
return intersectionWith((a, b) => isEqualWith(a, b, iterateeFunction), ...arrays);
}

@@ -0,1 +1,3 @@

import type { GenericFunction } from '../types.js';
/**

@@ -9,9 +11,13 @@ * The opposite of `before`. This method creates a function that invokes `func` once it's called `n` or more times.

* @example
* const caution = () => alert("Caution!");
* const caution = () => console.log("Caution!");
*
* // Display alert only after it has been called 5 times
* after(5, caution)
* const afterFN = after(2, caution);
*
* afterFN()
* afterFN()
* afterFN()
* // => `caution` is invoked after called twice
*/
export function after<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(n: number, func: TFunc) {
export function after<TFunc extends GenericFunction<TFunc>>(n: number, func: TFunc) {
let count = 1;

@@ -18,0 +24,0 @@ return (...args: Parameters<TFunc>): ReturnType<TFunc> | undefined => {

/**
* Creates a function that invokes `func`, with the `this` binding and arguments
* of the created function, while it's called less than `n` times. Subsequent
* Creates a function that invokes `func`, while it's called less than `n` times. Subsequent
* calls to the created function return the result of the last `func` invocation.

@@ -11,6 +10,11 @@ *

* @example
* const caution = () => alert("Caution!");
* const caution = () => console.log("Caution!");
*
* // Only call caution two times
* before(2, caution)
* const reducedCaution = before(2, caution)
*
* reducedCaution()
* reducedCaution()
* reducedCaution()
* // => `caution` is invoked twice
*/

@@ -17,0 +21,0 @@

@@ -0,9 +1,10 @@

import type { GenericFunction } from 'src/types.js';
// TODO this is a port from lodash, it probably can be improved and shortened, also fix TS errors
export function debounce<T extends (...args: Parameters<T>) => ReturnType<T>>(
fn: T, wait = 0, options: { leading?: boolean, maxWait?: number, trailing?: boolean } = {}
): (this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T> {
let lastArgs: Parameters<T> | undefined;
let lastThis: ThisParameterType<T> | undefined;
let result: ReturnType<T>;
export function debounce<TFunc extends GenericFunction<TFunc>>(
fn: TFunc, wait = 0, options: { leading?: boolean, maxWait?: number, trailing?: boolean } = {}
): (this: ThisParameterType<TFunc>, ...args: Parameters<TFunc>) => ReturnType<TFunc> {
let lastArgs: Parameters<TFunc> | undefined;
let lastThis: ThisParameterType<TFunc> | undefined;
let result: ReturnType<TFunc>;
let timerId: ReturnType<typeof setTimeout> | undefined;

@@ -18,8 +19,8 @@ let lastCallTime: number | undefined;

function invokeFunc(time: number) {
const args: Parameters<T> | undefined = lastArgs;
const thisArg: ThisParameterType<T> | undefined = lastThis;
const args: Parameters<TFunc> | undefined = lastArgs;
const thisArg: ThisParameterType<TFunc> | undefined = lastThis;
lastArgs = lastThis = undefined;
lastInvokeTime = time;
// @ts-ignore
// @ts-expect-error
result = fn.apply(thisArg, args);

@@ -39,3 +40,3 @@ return result;

function remainingWait(time: number) {
// @ts-ignore
// @ts-expect-error
const timeSinceLastCall = time - lastCallTime;

@@ -96,3 +97,3 @@ const timeSinceLastInvoke = time - lastInvokeTime;

function debounced(this: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T> {
function debounced(this: ThisParameterType<TFunc>, ...args: Parameters<TFunc>): ReturnType<TFunc> {
const time = Date.now();

@@ -99,0 +100,0 @@ const isInvoking = shouldInvoke(time);

@@ -7,1 +7,2 @@ export * from './after';

export * from './throttle';
export * from './times';

@@ -0,3 +1,4 @@

import type{ GenericFunction } from 'src/types.js';
const defaultResolver = (...args: unknown[]) => JSON.stringify(args);
type Cache = Map<string | symbol, unknown>;

@@ -19,2 +20,4 @@ /**

* @param resolver - The function to resolve the cache key.
* @typeParam TFunc - The input function type
* @typeParam Cache - The cache map type
* @returns Returns the new memoized function.

@@ -44,6 +47,7 @@ * @example

export function memoize<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(
export function memoize<TFunc extends GenericFunction<TFunc>, Cache extends Map<string | symbol, ReturnType<TFunc>>>(
func: TFunc, resolver: ((...args: Parameters<TFunc>) => string | symbol) = defaultResolver
): TFunc & { cache: Cache } {
const cache: Cache = new Map();
const cache = new Map() as Cache;
const memoizedFunc = (...args: Parameters<TFunc>): ReturnType<TFunc> => {

@@ -50,0 +54,0 @@ const key = resolver(...args);

@@ -0,1 +1,5 @@

import type { GenericFunction } from 'src/types.js';
import { before } from '@function/before';
/**

@@ -10,3 +14,3 @@ * Creates a function that is restricted to invoking `func` once. Repeat calls

* @example
* const initialize = once(createApplication)
* const initialize = once(() => console.log('initialize'))
* initialize()

@@ -16,6 +20,5 @@ * initialize()

*/
import { before } from '@function/before';
export function once<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(func: TFunc): TFunc {
export function once<TFunc extends GenericFunction<TFunc>>(func: TFunc): TFunc {
return before(1, func);
}

@@ -0,6 +1,8 @@

import type { GenericFunction } from 'src/types.js';
import { debounce } from '@function/debounce';
export function throttle<T extends (...args: Parameters<T>) => ReturnType<T>>(
func: T, wait = 0, options: { leading?: boolean, trailing?: boolean } = {}
): (this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T> {
export function throttle<TFunc extends GenericFunction<TFunc>>(
func: TFunc, wait = 0, options: { leading?: boolean, trailing?: boolean } = {}
): (this: ThisParameterType<TFunc>, ...args: Parameters<TFunc>) => ReturnType<TFunc> {
return debounce(func, wait, {

@@ -7,0 +9,0 @@ leading: options.leading ?? true,

@@ -1,2 +0,34 @@

export function isEmpty(value: unknown): boolean {
/**
* Checks if `value` is an empty object, collection, map, or set.
*
* Objects are considered empty if they have no own enumerable string keyed
* properties.
*
* Array-like values such as `arguments` objects, arrays, buffers, strings, or
* Similarly, maps and sets are considered empty if they have a `size` of `0`.
*
* @category Lang
* @param value - The value to check.
* @returns Returns `true` if `value` is empty, else `false`.
* @example
* isEmpty(null)
* // => true
*
* isEmpty({})
* // => true
*
* isEmpty("")
* // => true
*
* isEmpty([1, 2, 3])
* // => false
*
* isEmpty('abc')
* // => false
*
* isEmpty({ 'a': 1 })
* // => false
*/
export function isEmpty(value: string | object | null | undefined): boolean {
if (value === null || value === undefined) {

@@ -10,6 +42,2 @@ return true;

if (typeof value === 'number') {
return false;
}
if (value instanceof Map || value instanceof Set) {

@@ -16,0 +44,0 @@ return value.size === 0;

import type { RecordKey } from '../types';
/**
* Performs a deep comparison between two values to determine if they are
* equivalent.
*
* **Note:** This method supports comparing arrays, array buffers, booleans,
* date objects, error objects, maps, numbers, `Object` objects, regexes,
* sets, strings, symbols, and typed arrays. `Object` objects are compared
* by their own, not inherited, enumerable properties. Functions and DOM
* nodes are compared by strict equality, i.e. `===`.
*
* @category Lang
* @param value1 - The value to compare.
* @param value2 - The other value to compare.
* @returns Returns `true` if the values are equivalent, else `false`.
* @example
* var object = { 'a': 1 };
* var other = { 'a': 1 };
*
* _.isEqual(object, other);
* // => true
*
* object === other;
* // => false
*/
export function isEqual(value1: unknown, value2: unknown): boolean {

@@ -4,0 +30,0 @@ if (value1 === value2) return true;

import { isEqual } from '@lang/isEqual';
export function isEqualWith<T>(customizer: (value: T) => unknown, a: T, b: T): boolean {
/**
* This method is like `_.isEqual` except that it accepts `customizer` which
* is invoked to compare values. If `customizer` returns `undefined`, comparisons
* are handled by the method instead. The `customizer` is invoked with up to
* six arguments: (objValue, othValue [, index|key, object, other, stack]).
*
* @category Lang
* @param value1 - The value to compare.
* @param value2 - The other value to compare.
* @param customizer - The function to customize comparisons.
* @returns Returns `true` if the values are equivalent, else `false`.
* @example
* function isGreeting(value) {
* return /^h(?:i|ello)$/.test(value);
* }
*
* function customizer(objValue, othValue) {
* if (isGreeting(objValue) && isGreeting(othValue)) {
* return true;
* }
* }
*
* var array = ['hello', 'goodbye'];
* var other = ['hi', 'goodbye'];
*
* isEqualWith(array, other, customizer);
* // => true
*/
export function isEqualWith<T>(a: T, b: T, customizer: (value: T) => unknown): boolean {
return isEqual(customizer(a), customizer(b));
}

@@ -1,2 +0,2 @@

export type MinimumTwoArrays<T> = [T[], T[], ...T[][]];
export type MinimumTwoArrays<TInput> = [TInput[], TInput[], ...TInput[][]];

@@ -7,4 +7,10 @@ export type IterateeFunction<T> = (value: T) => unknown;

export type RecordKey = string | number | symbol;
export type ArrayOrRecord<TInput> = TInput[] | Record<RecordKey, TInput>;
export type ArrayOrRecord<T> = T[] | Record<RecordKey, T>;
export type NoUnion<T, U = T> = T extends U ? [U] extends [T] ? T : never : never;
export type NoUnion<T, U = T> = T extends U ? [U] extends [T] ? T : never : never;
/**
* @description Generic function type, should fit any function
* @typeParam TFunc - The input function type
*/
export type GenericFunction<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>> = (...args: Parameters<TFunc>) => ReturnType<TFunc>;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc