Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@eslint-react/tools

Package Overview
Dependencies
Maintainers
1
Versions
775
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eslint-react/tools - npm Package Compare versions

Comparing version 0.9.8-beta.0 to 0.9.8-beta.1

367

dist/index.d.ts

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

import * as Chunk from 'effect/Chunk';
export { Chunk };
import * as Data from 'effect/Data';

@@ -22,3 +20,3 @@ export { Data };

import * as Predicate from 'effect/Predicate';
export { Predicate as P };
export { Predicate as _ };
import * as ReadonlyArray from 'effect/ReadonlyArray';

@@ -30,225 +28,144 @@ export { ReadonlyArray as Array };

export { Ref };
import * as tsPattern from 'ts-pattern';
export { tsPattern as M };
/**
* Returns the element type of an array.
* @since 0.4.0
* @template T type of the array elements.
* @param arr The array to get the element type from.
* @returns The element type of the array.
*/
type ArrayElement<A> = A extends readonly (infer T)[] ? T : never;
/**
* Returns a new array with unique values based on the given function.
* @since 0.0.1
* @template T type of the array elements.
* @param arr The array to filter.
* @param fn The function to get the value to compare.
* @returns new array with unique values.
*/
declare function uniqueBy<T>(arr: readonly T[], fn: (x: T) => unknown): T[];
declare namespace Helper {
/**
* @param a
* @since 0.0.1
*/
const id: <T>(a: T) => T;
/**
* @since 0.0.1
*/
const noop: () => void;
/**
* @param a
* @since 0.0.1
*/
const constant: <T>(a: T) => () => T;
/**
* @param a The value to infer.
* @since 0.0.1
*/
const asConst: <const T>(a: T) => T;
/**
* Infers embedded primitive type of any type
* @since 0.0.1
* @param T Type to infer
* @returns Embedded type of {@link TType}
* @example
* type Result = Narrow<['foo', 'bar', 1]>
* @see https://twitter.com/hd_nvim/status/1578567206190780417
*/
type Narrow<TType> = {
[K in keyof TType]: Narrow<TType[K]>;
} | (TType extends [] ? [] : never) | (TType extends Function ? TType : never) | (TType extends bigint | boolean | number | string ? TType : never);
/**
* Infers embedded primitive type of any type
* Same as `as const` but without setting the object as readonly and without needing the user to use it.
* @since 0.0.1
* @param a Value to infer
* @returns Value with embedded type inferred
* @example
* const result = narrow(['foo', 'bar', 1])
*/
const narrow: <TType>(a: Narrow<TType>) => Narrow<TType>;
namespace Debug {
/**
* @since 0.0.1
*/
type Remap<T> = {
[P in keyof T]: T[P];
};
/**
* @since 0.0.1
*/
type Pretty<T> = {
[P in keyof T]: T[P];
} & {};
}
namespace Union {
/**
* @since 0.0.1
* @template T The type to get the union from
* @example
* type Result = UnionFromTuple<['foo', 'bar', 1]>
* // Result = 'foo' | 'bar' | 1
*/
type UnionFromTuple<T> = T extends (infer U)[] ? U : never;
/**
* @since 0.0.1
* @template T The type to get the intersection from
* @example
* type Result = IntersectionFromTuple<['foo', 'bar', 1]>
* // Result = 'foo' & 'bar' & 1
*/
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
}
namespace Record {
/**
* @since 0.4.0
*/
type Cast<X, Y> = X extends Y ? X : Y;
/**
* Returns the element type of an array.
* @since 0.4.0
* @template T type of the array elements.
* @param arr The array to get the element type from.
* @returns The element type of the array.
*/
type ArrayElement<A> = A extends readonly (infer T)[] ? T : never;
/**
* A record with loose keys.
* @template T The type of the values.
* @since 0.4.0
*/
export type LooseRecord<T> = Record<PropertyKey, T>;
export type DeepWriteable<T> = {
-readonly [P in keyof T]: DeepWriteable<T[P]>;
};
export type FromEntries<T> = T extends [infer Key, unknown][] ? {
[K in Cast<Key, string>]: Extract<ArrayElement<T>, [K, unknown]>[1];
} : {
[key in string]: unknown;
};
export type FromEntriesWithReadOnly<T> = FromEntries<DeepWriteable<T>>;
/**
* type-safe version of Object.fromEntries
* @param entries The entries to create the object from.
* @returns The object created from the entries.
* @since 0.4.0
*/
export const fromEntries: <T extends [PropertyKey, unknown][]>(entries: T) => FromEntries<T>;
/**
* type-safe version of Object.fromEntries
* @param entries The entries to create the object from.
* @returns The object created from the entries.
* @since 0.4.0
*/
export const fromEntriesWithReadOnly: <T extends [PropertyKey, unknown][]>(entries: T) => FromEntries<DeepWriteable<T>>;
/**
* type-safe version of Object.entries
* @param value The value to get the entries from.
* @returns The entries of the value.
* @since 0.4.0
*/
export const entries: <T extends LooseRecord<unknown>>(value: T) => { [K in keyof T]-?: [K, T[K]]; }[keyof T][];
/**
* type-safe version of Object.keys
* @param value The value to get the keys from.
* @returns The keys of the value.
* @since 0.4.0
*/
export const keys: <T extends LooseRecord<unknown>>(value: T) => (keyof T)[];
/**
* type-safe version of Object.values
* @param value The value to get the values from.
* @returns The values of the value.
* @since 0.4.0
*/
export const values: <T extends LooseRecord<unknown>>(value: T) => T[keyof T][];
export { };
}
}
/**
* @since 0.0.1
*/
declare const noop: () => void;
/**
* @since 0.0.1
* @param a The value to return.
*/
declare const identity: <T>(a: T) => T;
/**
* @since 0.9.0
*/
type Guard<T = unknown> = (x: unknown) => x is T;
/**
* @since 0.9.0
*/
type KeyGuard = Guard<number | string | symbol>;
/**
* @since 0.9.0
*/
type GuardReturnType<T extends Guard> = T extends Guard<infer U> ? U : never;
/**
* @since 0.9.0
*/
type GuardRecord = Record<PropertyKey, Guard>;
/**
* @since 0.9.0
*/
type LazyGuardRecord = Record<PropertyKey, () => Guard>;
/**
* @since 0.9.0
*/
type Assume<T, U> = T extends U ? T : never;
/**
* @since 0.4.0
*/
type Cast<X, Y> = X extends Y ? X : Y;
/**
* @since 0.9.0
*/
type Defined<T> = T extends undefined ? never : T;
/**
* @since 0.0.1
*/
type Remap<T> = {
[P in keyof T]: T[P];
};
/**
* @since 0.0.1
*/
type Pretty<T> = {
[P in keyof T]: T[P];
} & {};
/**
* Infers embedded primitive type of any type
* @since 0.0.1
* @param T Type to infer
* @returns Embedded type of {@link TType}
* @example
* type Result = Narrow<['foo', 'bar', 1]>
* @see https://twitter.com/hd_nvim/status/1578567206190780417
*/
type Narrow<TType> = {
[K in keyof TType]: Narrow<TType[K]>;
} | (TType extends [] ? [] : never) | (TType extends Function ? TType : never) | (TType extends bigint | boolean | number | string ? TType : never);
/**
* Infers embedded primitive type of any type
* Same as `as const` but without setting the object as readonly and without needing the user to use it.
* @since 0.0.1
* @param a Value to infer
* @returns Value with embedded type inferred
* @example
* const result = narrow(['foo', 'bar', 1])
*/
declare const narrow: <TType>(a: Narrow<TType>) => Narrow<TType>;
/**
* @param a The value to infer.
* @since 0.0.1
*/
declare const asConst: <const T>(a: T) => T;
/**
* @since 0.9.0
* @param guards The guards to check.
* @returns A guard that checks if given value is the kind of union.
*/
declare const isKindOfUnion: <T extends Guard[]>(...guards: T) => (x: unknown) => x is GuardReturnType<T[number]>;
/**
* @since 0.9.0
* @param isK The guard for the key.
* @param isV The guard for the value.
* @returns A guard that checks if given value is the kind of record.
*/
declare const isKindOfRecord: <K extends KeyGuard, V extends Guard>(isK: K, isV: V) => (x: unknown) => x is Record<GuardReturnType<K>, GuardReturnType<V>>;
/**
* @since 0.9.0
* @param guards The guards to check.
* @returns A guard that checks if given value is the kind of object.
*/
declare const isKindOfObject: <T extends GuardRecord>(guards: T) => (x: unknown) => x is { [key in keyof T]: GuardReturnType<T[key]>; };
/**
* @since 0.9.0
*/
declare const isKindObjectLazy: <T extends LazyGuardRecord>(guards: T) => (x: unknown) => x is { [key in keyof T]: GuardReturnType<ReturnType<T[key]>>; };
/**
* @since 0.9.0
* @param guard The guard to check.
* @returns A guard that checks if given value is the kind of array.
*/
declare const isKindOfArray: <T extends Guard>(guard: T) => (x: unknown) => x is T[];
/**
* @since 0.9.0
* @param guards The guards to check.
* @returns A guard that checks if given value is the kind of tuple.
*/
declare const isKindOfTuple: <T extends Guard[]>(guards: T) => (x: unknown) => x is { [key in keyof T]: GuardReturnType<T[key]>; };
/**
* @since 0.9.0
*/
declare const isKindOfOptional: <T>(guard: Guard<T>) => (x: unknown) => x is T | undefined;
/**
* @since 0.3.4
*/
type FieldDiff<T1, T2> = Omit<T1, keyof T2> | Omit<T2, keyof T1>;
/**
* @since 0.3.4
*/
type Combine<T1, T2> = Pretty<{
[K in keyof (T1 | T2)]: T1[K] | T2[K];
} & Partial<T1 & T2>>;
/**
* A record with loose keys.
* @template T The type of the values.
* @since 0.4.0
*/
type LooseRecord<T> = Record<PropertyKey, T>;
type DeepWriteable<T> = {
-readonly [P in keyof T]: DeepWriteable<T[P]>;
};
type FromEntries<T> = T extends [infer Key, unknown][] ? {
[K in Cast<Key, string>]: Extract<ArrayElement<T>, [K, unknown]>[1];
} : {
[key in string]: unknown;
};
type FromEntriesWithReadOnly<T> = FromEntries<DeepWriteable<T>>;
/**
* type-safe version of Object.fromEntries
* @param entries The entries to create the object from.
* @returns The object created from the entries.
* @since 0.4.0
*/
declare const fromEntries: <T extends [PropertyKey, unknown][]>(entries: T) => FromEntries<T>;
/**
* type-safe version of Object.fromEntries
* @param entries The entries to create the object from.
* @returns The object created from the entries.
* @since 0.4.0
*/
declare const fromEntriesWithReadOnly: <T extends [PropertyKey, unknown][]>(entries: T) => FromEntries<DeepWriteable<T>>;
/**
* type-safe version of Object.entries
* @param value The value to get the entries from.
* @returns The entries of the value.
* @since 0.4.0
*/
declare const entries: <T extends LooseRecord<unknown>>(value: T) => { [K in keyof T]-?: [K, T[K]]; }[keyof T][];
/**
* type-safe version of Object.keys
* @param value The value to get the keys from.
* @returns The keys of the value.
* @since 0.4.0
*/
declare const keys: <T extends LooseRecord<unknown>>(value: T) => (keyof T)[];
/**
* type-safe version of Object.values
* @param value The value to get the values from.
* @returns The values of the value.
* @since 0.4.0
*/
declare const values: <T extends LooseRecord<unknown>>(value: T) => T[keyof T][];
/**
* @since 0.0.1
* @template T The type to get the union from
* @example
* type Result = UnionFromTuple<['foo', 'bar', 1]>
* // Result = 'foo' | 'bar' | 1
*/
type UnionFromTuple<T> = T extends (infer U)[] ? U : never;
/**
* @since 0.0.1
* @template T The type to get the intersection from
* @example
* type Result = IntersectionFromTuple<['foo', 'bar', 1]>
* // Result = 'foo' & 'bar' & 1
*/
type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
export { type ArrayElement, type Assume, type Cast, type Combine, type DeepWriteable, type Defined, type FieldDiff, type FromEntries, type FromEntriesWithReadOnly, type Guard, type GuardRecord, type GuardReturnType, type KeyGuard, type LazyGuardRecord, type LooseRecord, type Narrow, type Pretty, type Remap, type UnionFromTuple, type UnionToIntersection, asConst, entries, fromEntries, fromEntriesWithReadOnly, identity, isKindObjectLazy, isKindOfArray, isKindOfObject, isKindOfOptional, isKindOfRecord, isKindOfTuple, isKindOfUnion, keys, narrow, noop, uniqueBy, values };
export { Helper };
{
"name": "@eslint-react/tools",
"version": "0.9.8-beta.0",
"version": "0.9.8-beta.1",
"description": "ESLint React's std library and primitives.",

@@ -38,8 +38,7 @@ "homepage": "https://github.com/rel1cx/eslint-react",

"dependencies": {
"effect": "2.0.0-next.60",
"ts-pattern": "5.0.6"
"effect": "2.0.0-next.60"
},
"scripts": {
"build": "rollup -c rollup.config.ts --configPlugin swc3 && cp dist/index.d.ts dist/index.d.mts",
"build:docs": "typedoc && dprint fmt ./docs/**/*.md",
"build:docs": "typedoc",
"lint:publish": "publint",

@@ -46,0 +45,0 @@ "lint:type": "tsc --noEmit"

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 too big to display

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