@nothing-but/utils
Advanced tools
Comparing version 0.14.0 to 0.15.0
@@ -18,5 +18,3 @@ /** | ||
export type ReadonlyNumArray = ReadonlyArrayLike<number>; | ||
/** | ||
* Check shallow array equality | ||
*/ | ||
/** Check shallow array equality */ | ||
export declare function equals(a: ReadonlyArrayLike<unknown>, b: ReadonlyArrayLike<unknown>): boolean; | ||
@@ -31,5 +29,4 @@ export declare function wrap<T>(arr: readonly T[], index: number): T | undefined; | ||
/** | ||
* Checks if both arrays contain the same values. | ||
* Order doesn't matter. | ||
* Arrays must not contain duplicates. (be the same lengths) | ||
* Checks if both arrays contain the same values. Order doesn't matter. Arrays must not contain | ||
* duplicates. (be the same lengths) | ||
*/ | ||
@@ -40,2 +37,3 @@ export declare function includes_same_members(a: readonly unknown[], b: readonly unknown[]): boolean; | ||
export declare function mutate_filter<T>(array: T[], predicate: (value: T, index: number, array: T[]) => unknown): void; | ||
export declare function unordered_remove(array: any[], idx: number): void; | ||
export declare function remove<T>(array: T[], item: T): void; | ||
@@ -46,21 +44,25 @@ export declare const pick_random: <T>(arr: readonly T[]) => T | undefined; | ||
/** | ||
* Push to the end of the array, but shift all items to the left, removing the first item and keeping the length the same. | ||
* Push to the end of the array, but shift all items to the left, removing the first item and | ||
* keeping the length the same. | ||
*/ | ||
export declare function fixedPush<T>(arr: ArrayLike<T>, value: T): void; | ||
/** | ||
* Push to the end of the array, but shift all items to the left, removing the first item and keeping the length the same. | ||
* Push to the end of the array, but shift all items to the left, removing the first item and | ||
* keeping the length the same. | ||
*/ | ||
export declare function fixedPushMany<T>(arr: ArrayLike<T>, ...values: T[]): void; | ||
/** | ||
* Push to the start of the array, and shift all items to the right, removing the last item and keeping the length the same. | ||
* Push to the start of the array, and shift all items to the right, removing the last item and | ||
* keeping the length the same. | ||
*/ | ||
export declare function fixedUnshift<T>(arr: ArrayLike<T>, value: T): void; | ||
/** | ||
* Push to the start of the array, and shift all items to the right, removing the last item and keeping the length the same. | ||
* Push to the start of the array, and shift all items to the right, removing the last item and | ||
* keeping the length the same. | ||
*/ | ||
export declare function fixedUnshiftMany<T>(arr: ArrayLike<T>, ...values: T[]): void; | ||
/** | ||
* Returns a new array with {@link top_n} top items from the given {@link arr}. | ||
* The score is determined by the {@link getScore} function. | ||
* The returned array is sorted from highest to lowest score. | ||
* Returns a new array with {@link top_n} top items from the given {@link arr}. The score is | ||
* determined by the {@link getScore} function. The returned array is sorted from highest to lowest | ||
* score. | ||
*/ | ||
@@ -67,0 +69,0 @@ export declare const top_n_with: <T>(arr: readonly T[], top_n: number, getScore: (item: T) => number) => T[]; |
import { num } from "./index.js"; | ||
/** | ||
* Check shallow array equality | ||
*/ | ||
/** Check shallow array equality */ | ||
export function equals(a, b) { | ||
@@ -38,5 +36,4 @@ if (a === b) | ||
/** | ||
* Checks if both arrays contain the same values. | ||
* Order doesn't matter. | ||
* Arrays must not contain duplicates. (be the same lengths) | ||
* Checks if both arrays contain the same values. Order doesn't matter. Arrays must not contain | ||
* duplicates. (be the same lengths) | ||
*/ | ||
@@ -73,2 +70,6 @@ export function includes_same_members(a, b) { | ||
} | ||
export function unordered_remove(array, idx) { | ||
[array[idx], array[array.length - 1]] = [array[array.length - 1], array[idx]]; | ||
array.length -= 1; | ||
} | ||
export function remove(array, item) { | ||
@@ -94,3 +95,4 @@ array.splice(array.indexOf(item), 1); | ||
/** | ||
* Push to the end of the array, but shift all items to the left, removing the first item and keeping the length the same. | ||
* Push to the end of the array, but shift all items to the left, removing the first item and | ||
* keeping the length the same. | ||
*/ | ||
@@ -105,3 +107,4 @@ export function fixedPush(arr, value) { | ||
/** | ||
* Push to the end of the array, but shift all items to the left, removing the first item and keeping the length the same. | ||
* Push to the end of the array, but shift all items to the left, removing the first item and | ||
* keeping the length the same. | ||
*/ | ||
@@ -118,3 +121,4 @@ export function fixedPushMany(arr, ...values) { | ||
/** | ||
* Push to the start of the array, and shift all items to the right, removing the last item and keeping the length the same. | ||
* Push to the start of the array, and shift all items to the right, removing the last item and | ||
* keeping the length the same. | ||
*/ | ||
@@ -128,3 +132,4 @@ export function fixedUnshift(arr, value) { | ||
/** | ||
* Push to the start of the array, and shift all items to the right, removing the last item and keeping the length the same. | ||
* Push to the start of the array, and shift all items to the right, removing the last item and | ||
* keeping the length the same. | ||
*/ | ||
@@ -141,5 +146,5 @@ export function fixedUnshiftMany(arr, ...values) { | ||
/** | ||
* Returns a new array with {@link top_n} top items from the given {@link arr}. | ||
* The score is determined by the {@link getScore} function. | ||
* The returned array is sorted from highest to lowest score. | ||
* Returns a new array with {@link top_n} top items from the given {@link arr}. The score is | ||
* determined by the {@link getScore} function. The returned array is sorted from highest to lowest | ||
* score. | ||
*/ | ||
@@ -146,0 +151,0 @@ export const top_n_with = (arr, top_n, getScore) => { |
/** | ||
* Resizes the canvas to match the size it is being displayed. | ||
* @param canvas the canvas to resize | ||
* | ||
* @param canvas the canvas to resize | ||
* @returns `true` if the canvas was resized | ||
@@ -8,6 +9,3 @@ */ | ||
export interface CanvasResizeObserver { | ||
/** | ||
* Canvas was resized since last check. | ||
* Set it to `false` to reset. | ||
*/ | ||
/** Canvas was resized since last check. Set it to `false` to reset. */ | ||
resized: boolean; | ||
@@ -14,0 +12,0 @@ canvas: HTMLCanvasElement; |
/** | ||
* Resizes the canvas to match the size it is being displayed. | ||
* @param canvas the canvas to resize | ||
* | ||
* @param canvas the canvas to resize | ||
* @returns `true` if the canvas was resized | ||
@@ -8,8 +9,8 @@ */ | ||
// Get the size the browser is displaying the canvas in device pixels. | ||
const dpr = window.devicePixelRatio; | ||
const { width, height } = canvas.getBoundingClientRect(); | ||
const display_width = Math.round(width * dpr); | ||
const display_height = Math.round(height * dpr); | ||
let dpr = window.devicePixelRatio; | ||
let { width, height } = canvas.getBoundingClientRect(); | ||
let display_width = Math.round(width * dpr); | ||
let display_height = Math.round(height * dpr); | ||
// Check if the canvas is not the same size. | ||
const need_resize = canvas.width != display_width || canvas.height != display_height; | ||
let need_resize = canvas.width != display_width || canvas.height != display_height; | ||
if (need_resize) { | ||
@@ -22,3 +23,3 @@ canvas.width = display_width; | ||
export function resizeCanvasObserver(observer) { | ||
const resized = resizeCanvasToDisplaySize(observer.canvas); | ||
let resized = resizeCanvasToDisplaySize(observer.canvas); | ||
observer.resized ||= resized; | ||
@@ -28,3 +29,3 @@ return resized; | ||
export function makeCanvasResizeObserver(canvas) { | ||
const canvas_observer = { | ||
let canvas_observer = { | ||
resized: false, | ||
@@ -35,3 +36,3 @@ canvas, | ||
canvas_observer.observer = new ResizeObserver(resizeCanvasObserver.bind(null, canvas_observer)); | ||
void resizeCanvasObserver(canvas_observer); | ||
resizeCanvasObserver(canvas_observer); | ||
canvas_observer.observer.observe(canvas); | ||
@@ -38,0 +39,0 @@ return canvas_observer; |
@@ -1,4 +0,2 @@ | ||
/** | ||
* Represents a color in the RGB color space. | ||
*/ | ||
/** Represents a color in the RGB color space. */ | ||
export declare class RGB { | ||
@@ -10,2 +8,3 @@ r: number; | ||
* Creates an instance of the RGB class. | ||
* | ||
* @param r - The red component of the RGB color. | ||
@@ -16,11 +15,6 @@ * @param g - The green component of the RGB color. | ||
constructor(r: number, g: number, b: number); | ||
/** | ||
* Returns a string representation of the RGB color in the format "rgb(r g b)". | ||
*/ | ||
/** Returns a string representation of the RGB color in the format "rgb(r g b)". */ | ||
toString: () => string; | ||
} | ||
/** | ||
* Represents a color in the RGBA color space. | ||
* Extends the RGB class and adds an alpha component. | ||
*/ | ||
/** Represents a color in the RGBA color space. Extends the RGB class and adds an alpha component. */ | ||
export declare class RGBA extends RGB { | ||
@@ -30,2 +24,3 @@ a: number; | ||
* Creates an instance of the RGBA class. | ||
* | ||
* @param r - The red component of the RGBA color. | ||
@@ -37,5 +32,3 @@ * @param g - The green component of the RGBA color. | ||
constructor(r: number, g: number, b: number, a: number); | ||
/** | ||
* Returns a string representation of the RGBA color in the format "rgb(r g b / a)". | ||
*/ | ||
/** Returns a string representation of the RGBA color in the format "rgb(r g b / a)". */ | ||
toString: () => string; | ||
@@ -45,4 +38,5 @@ } | ||
* Converts an RGB color to a string representation. | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "rgb(r g b)" representing the RGB color. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "rgb(r g b)" representing the RGB color. | ||
*/ | ||
@@ -52,4 +46,5 @@ export declare function rgb_to_string(rgb: RGB): string; | ||
* Converts an RGBA color to a string representation. | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A string in the format "rgb(r g b / a)" representing the RGBA color. | ||
* | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A string in the format "rgb(r g b / a)" representing the RGBA color. | ||
*/ | ||
@@ -59,5 +54,6 @@ export declare function rgba_to_string(rgba: RGBA): string; | ||
* Converts an RGB color to an RGBA color with the specified alpha component. | ||
* @param rgb - The RGB color to be converted. | ||
* @param a - The alpha component (opacity) of the resulting RGBA color. | ||
* @returns A new RGBA color with the same RGB components and the specified alpha. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @param a - The alpha component (opacity) of the resulting RGBA color. | ||
* @returns A new RGBA color with the same RGB components and the specified alpha. | ||
*/ | ||
@@ -67,4 +63,5 @@ export declare function rgb_to_rgba(rgb: RGB, a: number): RGBA; | ||
* Converts an RGB color to a numeric representation (32-bit integer). | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A numeric value representing the RGB color. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A numeric value representing the RGB color. | ||
*/ | ||
@@ -74,4 +71,5 @@ export declare function rgb_int(rgb: RGB): number; | ||
* Converts a numeric representation (32-bit integer) to an RGB color. | ||
* @param value - The numeric value representing the RGB color. | ||
* @returns A new RGB color with components extracted from the numeric value. | ||
* | ||
* @param value - The numeric value representing the RGB color. | ||
* @returns A new RGB color with components extracted from the numeric value. | ||
*/ | ||
@@ -81,4 +79,5 @@ export declare function rgb_int_to_rgb(value: number): RGB; | ||
* Converts an RGBA color to a numeric representation (32-bit integer). | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A numeric value representing the RGBA color. | ||
* | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A numeric value representing the RGBA color. | ||
*/ | ||
@@ -88,4 +87,5 @@ export declare function rgba_int(rgba: RGBA): number; | ||
* Converts a numeric representation (32-bit integer) to an RGBA color. | ||
* @param value - The numeric value representing the RGBA color. | ||
* @returns A new RGBA color with components extracted from the numeric value. | ||
* | ||
* @param value - The numeric value representing the RGBA color. | ||
* @returns A new RGBA color with components extracted from the numeric value. | ||
*/ | ||
@@ -95,5 +95,6 @@ export declare function rgba_int_to_rgba(value: number): RGBA; | ||
* Converts an RGB color and an alpha component to a numeric representation (32-bit integer). | ||
* @param rgb - The RGB color to be converted. | ||
* @param a - The alpha component (opacity) of the resulting RGBA color. | ||
* @returns A numeric value representing the RGBA color with the specified alpha. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @param a - The alpha component (opacity) of the resulting RGBA color. | ||
* @returns A numeric value representing the RGBA color with the specified alpha. | ||
*/ | ||
@@ -103,4 +104,5 @@ export declare function rgb_to_rgba_int(rgb: RGB, a: number): number; | ||
* Converts an RGB color to a CSS-compatible string representation. | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "r g b" representing the RGB color. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "r g b" representing the RGB color. | ||
*/ | ||
@@ -110,4 +112,5 @@ export declare function rgb_value(rgb: RGB): string; | ||
* Converts an RGB color to a hexadecimal string representation. | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "#rrggbb" representing the RGB color in hexadecimal notation. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "#rrggbb" representing the RGB color in hexadecimal notation. | ||
*/ | ||
@@ -117,4 +120,6 @@ export declare function rgb_to_hex(rgb: RGB): string; | ||
* Converts an RGBA color to a hexadecimal string representation. | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A string in the format "#rrggbbaa" representing the RGBA color in hexadecimal notation. | ||
* | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A string in the format "#rrggbbaa" representing the RGBA color in hexadecimal | ||
* notation. | ||
*/ | ||
@@ -125,5 +130,4 @@ export declare function rgba_to_hex(rgba: RGBA): string; | ||
* | ||
* @example | ||
* hexToRGBA('#ff0000') // { r: 255, g: 0, b: 0 } | ||
* hexToRGBA('#f00') // { r: 255, g: 0, b: 0 } | ||
* @example hexToRGBA('#ff0000') // { r: 255, g: 0, b: 0 } hexToRGBA('#f00') // { r: 255, g: 0, b: 0 | ||
* } | ||
*/ | ||
@@ -134,9 +138,7 @@ export declare function hex_to_rgb(hex: string): RGB; | ||
* | ||
* @example | ||
* hexToRGBA('#ff0000') // { r: 255, g: 0, b: 0, a: 1 } | ||
* hexToRGBA('#ff000000') // { r: 255, g: 0, b: 0, a: 0 } | ||
* hexToRGBA('#f00') // { r: 255, g: 0, b: 0, a: 1 } | ||
* hexToRGBA('#f000') // { r: 255, g: 0, b: 0, a: 0 } | ||
* @example hexToRGBA('#ff0000') // { r: 255, g: 0, b: 0, a: 1 } hexToRGBA('#ff000000') // { r: 255, | ||
* g: 0, b: 0, a: 0 } hexToRGBA('#f00') // { r: 255, g: 0, b: 0, a: 1 } hexToRGBA('#f000') // { r: | ||
* 255, g: 0, b: 0, a: 0 } | ||
*/ | ||
export declare function hex_to_rgba(hex: string): RGBA; | ||
//# sourceMappingURL=color.d.ts.map |
@@ -1,4 +0,2 @@ | ||
/** | ||
* Represents a color in the RGB color space. | ||
*/ | ||
/** Represents a color in the RGB color space. */ | ||
export class RGB { | ||
@@ -10,2 +8,3 @@ r; | ||
* Creates an instance of the RGB class. | ||
* | ||
* @param r - The red component of the RGB color. | ||
@@ -20,11 +19,6 @@ * @param g - The green component of the RGB color. | ||
} | ||
/** | ||
* Returns a string representation of the RGB color in the format "rgb(r g b)". | ||
*/ | ||
/** Returns a string representation of the RGB color in the format "rgb(r g b)". */ | ||
toString = rgb_to_string.bind(null, this); | ||
} | ||
/** | ||
* Represents a color in the RGBA color space. | ||
* Extends the RGB class and adds an alpha component. | ||
*/ | ||
/** Represents a color in the RGBA color space. Extends the RGB class and adds an alpha component. */ | ||
export class RGBA extends RGB { | ||
@@ -34,2 +28,3 @@ a; | ||
* Creates an instance of the RGBA class. | ||
* | ||
* @param r - The red component of the RGBA color. | ||
@@ -41,8 +36,6 @@ * @param g - The green component of the RGBA color. | ||
constructor(r, g, b, a) { | ||
super(r, g, b); | ||
this.a = a; | ||
void super(r, g, b); | ||
} | ||
/** | ||
* Returns a string representation of the RGBA color in the format "rgb(r g b / a)". | ||
*/ | ||
/** Returns a string representation of the RGBA color in the format "rgb(r g b / a)". */ | ||
toString = rgba_to_string.bind(null, this); | ||
@@ -52,4 +45,5 @@ } | ||
* Converts an RGB color to a string representation. | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "rgb(r g b)" representing the RGB color. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "rgb(r g b)" representing the RGB color. | ||
*/ | ||
@@ -61,4 +55,5 @@ export function rgb_to_string(rgb) { | ||
* Converts an RGBA color to a string representation. | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A string in the format "rgb(r g b / a)" representing the RGBA color. | ||
* | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A string in the format "rgb(r g b / a)" representing the RGBA color. | ||
*/ | ||
@@ -70,5 +65,6 @@ export function rgba_to_string(rgba) { | ||
* Converts an RGB color to an RGBA color with the specified alpha component. | ||
* @param rgb - The RGB color to be converted. | ||
* @param a - The alpha component (opacity) of the resulting RGBA color. | ||
* @returns A new RGBA color with the same RGB components and the specified alpha. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @param a - The alpha component (opacity) of the resulting RGBA color. | ||
* @returns A new RGBA color with the same RGB components and the specified alpha. | ||
*/ | ||
@@ -80,4 +76,5 @@ export function rgb_to_rgba(rgb, a) { | ||
* Converts an RGB color to a numeric representation (32-bit integer). | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A numeric value representing the RGB color. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A numeric value representing the RGB color. | ||
*/ | ||
@@ -89,4 +86,5 @@ export function rgb_int(rgb) { | ||
* Converts a numeric representation (32-bit integer) to an RGB color. | ||
* @param value - The numeric value representing the RGB color. | ||
* @returns A new RGB color with components extracted from the numeric value. | ||
* | ||
* @param value - The numeric value representing the RGB color. | ||
* @returns A new RGB color with components extracted from the numeric value. | ||
*/ | ||
@@ -98,4 +96,5 @@ export function rgb_int_to_rgb(value) { | ||
* Converts an RGBA color to a numeric representation (32-bit integer). | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A numeric value representing the RGBA color. | ||
* | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A numeric value representing the RGBA color. | ||
*/ | ||
@@ -107,4 +106,5 @@ export function rgba_int(rgba) { | ||
* Converts a numeric representation (32-bit integer) to an RGBA color. | ||
* @param value - The numeric value representing the RGBA color. | ||
* @returns A new RGBA color with components extracted from the numeric value. | ||
* | ||
* @param value - The numeric value representing the RGBA color. | ||
* @returns A new RGBA color with components extracted from the numeric value. | ||
*/ | ||
@@ -116,5 +116,6 @@ export function rgba_int_to_rgba(value) { | ||
* Converts an RGB color and an alpha component to a numeric representation (32-bit integer). | ||
* @param rgb - The RGB color to be converted. | ||
* @param a - The alpha component (opacity) of the resulting RGBA color. | ||
* @returns A numeric value representing the RGBA color with the specified alpha. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @param a - The alpha component (opacity) of the resulting RGBA color. | ||
* @returns A numeric value representing the RGBA color with the specified alpha. | ||
*/ | ||
@@ -126,4 +127,5 @@ export function rgb_to_rgba_int(rgb, a) { | ||
* Converts an RGB color to a CSS-compatible string representation. | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "r g b" representing the RGB color. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "r g b" representing the RGB color. | ||
*/ | ||
@@ -135,4 +137,5 @@ export function rgb_value(rgb) { | ||
* Converts an RGB color to a hexadecimal string representation. | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "#rrggbb" representing the RGB color in hexadecimal notation. | ||
* | ||
* @param rgb - The RGB color to be converted. | ||
* @returns A string in the format "#rrggbb" representing the RGB color in hexadecimal notation. | ||
*/ | ||
@@ -144,4 +147,6 @@ export function rgb_to_hex(rgb) { | ||
* Converts an RGBA color to a hexadecimal string representation. | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A string in the format "#rrggbbaa" representing the RGBA color in hexadecimal notation. | ||
* | ||
* @param rgba - The RGBA color to be converted. | ||
* @returns A string in the format "#rrggbbaa" representing the RGBA color in hexadecimal | ||
* notation. | ||
*/ | ||
@@ -154,5 +159,4 @@ export function rgba_to_hex(rgba) { | ||
* | ||
* @example | ||
* hexToRGBA('#ff0000') // { r: 255, g: 0, b: 0 } | ||
* hexToRGBA('#f00') // { r: 255, g: 0, b: 0 } | ||
* @example hexToRGBA('#ff0000') // { r: 255, g: 0, b: 0 } hexToRGBA('#f00') // { r: 255, g: 0, b: 0 | ||
* } | ||
*/ | ||
@@ -176,7 +180,5 @@ export function hex_to_rgb(hex) { | ||
* | ||
* @example | ||
* hexToRGBA('#ff0000') // { r: 255, g: 0, b: 0, a: 1 } | ||
* hexToRGBA('#ff000000') // { r: 255, g: 0, b: 0, a: 0 } | ||
* hexToRGBA('#f00') // { r: 255, g: 0, b: 0, a: 1 } | ||
* hexToRGBA('#f000') // { r: 255, g: 0, b: 0, a: 0 } | ||
* @example hexToRGBA('#ff0000') // { r: 255, g: 0, b: 0, a: 1 } hexToRGBA('#ff000000') // { r: 255, | ||
* g: 0, b: 0, a: 0 } hexToRGBA('#f00') // { r: 255, g: 0, b: 0, a: 1 } hexToRGBA('#f000') // { r: | ||
* 255, g: 0, b: 0, a: 0 } | ||
*/ | ||
@@ -183,0 +185,0 @@ export function hex_to_rgba(hex) { |
/** | ||
* No easing, no acceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -9,4 +10,5 @@ export declare function linear(t: number): number; | ||
* Slight acceleration from zero to full speed | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -16,4 +18,5 @@ export declare function in_sine(t: number): number; | ||
* Slight deceleration at the end | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -23,4 +26,5 @@ export declare function out_sine(t: number): number; | ||
* Slight acceleration at beginning and slight deceleration at end | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -30,4 +34,5 @@ export declare function in_out_sine(t: number): number; | ||
* Accelerating from zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -37,4 +42,5 @@ export declare function in_quad(t: number): number; | ||
* Decelerating to zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -44,4 +50,5 @@ export declare function out_quad(t: number): number; | ||
* Acceleration until halfway, then deceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -51,4 +58,5 @@ export declare function in_out_quad(t: number): number; | ||
* Accelerating from zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -58,4 +66,5 @@ export declare function in_cubic(t: number): number; | ||
* Decelerating to zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -65,4 +74,5 @@ export declare function out_cubic(t: number): number; | ||
* Acceleration until halfway, then deceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -72,4 +82,5 @@ export declare function in_out_cubic(t: number): number; | ||
* Accelerating from zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -79,4 +90,5 @@ export declare function in_quart(t: number): number; | ||
* Decelerating to zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -86,4 +98,5 @@ export declare function out_quart(t: number): number; | ||
* Acceleration until halfway, then deceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -93,4 +106,5 @@ export declare function in_out_quart(t: number): number; | ||
* Accelerating from zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -100,4 +114,5 @@ export declare function in_quint(t: number): number; | ||
* Decelerating to zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -107,4 +122,5 @@ export declare function out_quint(t: number): number; | ||
* Acceleration until halfway, then deceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -114,4 +130,5 @@ export declare function in_out_quint(t: number): number; | ||
* Accelerate exponentially until finish | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -121,4 +138,5 @@ export declare function in_expo(t: number): number; | ||
* Initial exponential acceleration slowing to stop | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -128,4 +146,5 @@ export declare function out_expo(t: number): number; | ||
* Exponential acceleration and deceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -135,4 +154,5 @@ export declare function in_out_expo(t: number): number; | ||
* Increasing velocity until stop | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -142,4 +162,5 @@ export declare function in_circ(t: number): number; | ||
* Start fast, decreasing velocity until stop | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -149,4 +170,5 @@ export declare function out_circ(t: number): number; | ||
* Fast increase in velocity, fast decrease in velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -156,5 +178,6 @@ export declare function in_out_circ(t: number): number; | ||
* Slow movement backwards then fast snap to finish | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
*/ | ||
@@ -164,5 +187,6 @@ export declare function in_back(t: number, magnitude?: number): number; | ||
* Fast snap to backwards point then slow resolve to finish | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
*/ | ||
@@ -172,5 +196,6 @@ export declare function out_back(t: number, magnitude?: number): number; | ||
* Slow movement backwards, fast snap to past finish, slow resolve to finish | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
*/ | ||
@@ -180,5 +205,6 @@ export declare function in_out_back(t: number, magnitude?: number): number; | ||
* Bounces slowly then quickly to finish | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
*/ | ||
@@ -188,5 +214,6 @@ export declare function in_elastic(t: number, magnitude?: number): number; | ||
* Fast acceleration, bounces to zero | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
*/ | ||
@@ -196,5 +223,6 @@ export declare function out_elastic(t: number, magnitude?: number): number; | ||
* Slow start and end, two bounces sandwich a fast motion | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
*/ | ||
@@ -204,4 +232,5 @@ export declare function in_out_elastic(t: number, magnitude?: number): number; | ||
* Bounce to completion | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -211,4 +240,5 @@ export declare function out_bounce(t: number): number; | ||
* Bounce increasing in velocity until completion | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -218,6 +248,7 @@ export declare function in_bounce(t: number): number; | ||
* Bounce in and bounce out | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
export declare function in_out_bounce(t: number): number; | ||
//# sourceMappingURL=ease.d.ts.map |
167
dist/ease.js
/** | ||
* No easing, no acceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -11,4 +12,5 @@ export function linear(t) { | ||
* Slight acceleration from zero to full speed | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -20,4 +22,5 @@ export function in_sine(t) { | ||
* Slight deceleration at the end | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -29,4 +32,5 @@ export function out_sine(t) { | ||
* Slight acceleration at beginning and slight deceleration at end | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -38,4 +42,5 @@ export function in_out_sine(t) { | ||
* Accelerating from zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -47,4 +52,5 @@ export function in_quad(t) { | ||
* Decelerating to zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -56,4 +62,5 @@ export function out_quad(t) { | ||
* Acceleration until halfway, then deceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -65,4 +72,5 @@ export function in_out_quad(t) { | ||
* Accelerating from zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -74,4 +82,5 @@ export function in_cubic(t) { | ||
* Decelerating to zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -84,4 +93,5 @@ export function out_cubic(t) { | ||
* Acceleration until halfway, then deceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -93,4 +103,5 @@ export function in_out_cubic(t) { | ||
* Accelerating from zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -102,4 +113,5 @@ export function in_quart(t) { | ||
* Decelerating to zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -112,4 +124,5 @@ export function out_quart(t) { | ||
* Acceleration until halfway, then deceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -122,4 +135,5 @@ export function in_out_quart(t) { | ||
* Accelerating from zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -131,4 +145,5 @@ export function in_quint(t) { | ||
* Decelerating to zero velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -141,4 +156,5 @@ export function out_quint(t) { | ||
* Acceleration until halfway, then deceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -151,4 +167,5 @@ export function in_out_quint(t) { | ||
* Accelerate exponentially until finish | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -163,4 +180,5 @@ export function in_expo(t) { | ||
* Initial exponential acceleration slowing to stop | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -172,4 +190,5 @@ export function out_expo(t) { | ||
* Exponential acceleration and deceleration | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -184,4 +203,5 @@ export function in_out_expo(t) { | ||
* Increasing velocity until stop | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -194,4 +214,5 @@ export function in_circ(t) { | ||
* Start fast, decreasing velocity until stop | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -204,4 +225,5 @@ export function out_circ(t) { | ||
* Fast increase in velocity, fast decrease in velocity | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -214,5 +236,6 @@ export function in_out_circ(t) { | ||
* Slow movement backwards then fast snap to finish | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
*/ | ||
@@ -224,5 +247,6 @@ export function in_back(t, magnitude = 1.70158) { | ||
* Fast snap to backwards point then slow resolve to finish | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
*/ | ||
@@ -235,5 +259,6 @@ export function out_back(t, magnitude = 1.70158) { | ||
* Slow movement backwards, fast snap to past finish, slow resolve to finish | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 1.70158) | ||
* @returns The eased value | ||
*/ | ||
@@ -246,5 +271,6 @@ export function in_out_back(t, magnitude = 1.70158) { | ||
* Bounces slowly then quickly to finish | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
*/ | ||
@@ -259,5 +285,6 @@ export function in_elastic(t, magnitude = 0.7) { | ||
* Fast acceleration, bounces to zero | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
*/ | ||
@@ -273,5 +300,6 @@ export function out_elastic(t, magnitude = 0.7) { | ||
* Slow start and end, two bounces sandwich a fast motion | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @param magnitude - The magnitude of the easing (default: 0.7) | ||
* @returns The eased value | ||
*/ | ||
@@ -289,4 +317,5 @@ export function in_out_elastic(t, magnitude = 0.7) { | ||
* Bounce to completion | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -311,4 +340,5 @@ export function out_bounce(t) { | ||
* Bounce increasing in velocity until completion | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -320,4 +350,5 @@ export function in_bounce(t) { | ||
* Bounce in and bounce out | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
* | ||
* @param t - The current time (between 0 and 1) | ||
* @returns The eased value | ||
*/ | ||
@@ -324,0 +355,0 @@ export function in_out_bounce(t) { |
@@ -30,5 +30,3 @@ import * as T from "./types.js"; | ||
export declare function listenerMap<TEventMap extends Record<string, Event>>(target: EventTarget, handlersMap: Partial<EventHandlerMap<TEventMap>>, options?: EventListenerOptions): () => void; | ||
/** | ||
* Alias to {@link listenerMap} | ||
*/ | ||
/** Alias to {@link listenerMap} */ | ||
export declare const listeners: typeof listenerMap; | ||
@@ -35,0 +33,0 @@ export declare function createListeners<TTarget extends TargetWithEventMap, TEventMap extends EventMapOf<TTarget>, THandlersMap extends Partial<EventHandlerMap<TEventMap>>>(target: TTarget, handlersMap: THandlersMap, options?: EventListenerOptions): void; |
@@ -54,5 +54,3 @@ import { onCleanup } from "./lifecycle.js"; | ||
} | ||
/** | ||
* Alias to {@link listenerMap} | ||
*/ | ||
/** Alias to {@link listenerMap} */ | ||
export const listeners = listenerMap; | ||
@@ -59,0 +57,0 @@ export function createListeners(target, handlers, options) { |
@@ -6,25 +6,13 @@ import { AnyClass, Noop } from "./types.js"; | ||
export declare const false_fn: () => boolean; | ||
/** | ||
* `a ^ b` | ||
*/ | ||
/** `a ^ b` */ | ||
export declare function xor(a: boolean, b: boolean): boolean; | ||
/** | ||
* Get entries of an object | ||
*/ | ||
/** Get entries of an object */ | ||
export declare const entries: <T extends object>(obj: T) => [keyof T, T[keyof T]][]; | ||
/** | ||
* Get keys of an object | ||
*/ | ||
/** Get keys of an object */ | ||
export declare const keys: <T extends object>(object: T) => (keyof T)[]; | ||
/** | ||
* Converts any value to an Error. | ||
*/ | ||
/** Converts any value to an Error. */ | ||
export declare function toError(e: unknown): Error; | ||
/** | ||
* Check if a value is a PlainObject. A PlainObject is an object with no prototype. | ||
*/ | ||
/** Check if a value is a PlainObject. A PlainObject is an object with no prototype. */ | ||
export declare const is_plain_object: (value: unknown) => value is Record<string, unknown>; | ||
/** | ||
* Check if the value is an instance of ___ | ||
*/ | ||
/** Check if the value is an instance of ___ */ | ||
export declare const is_of_class: (v: any, c: AnyClass) => boolean; | ||
@@ -38,3 +26,4 @@ /** | ||
/** | ||
* Returns a function that will call all functions in the order they were chained with the same arguments. | ||
* Returns a function that will call all functions in the order they were chained with the same | ||
* arguments. | ||
*/ | ||
@@ -44,6 +33,4 @@ export declare function chain<Args extends [] | any[]>(callbacks: { | ||
}): (...args: Args) => void; | ||
/** | ||
* Returns a function that will call all functions in the reversed order with the same arguments. | ||
*/ | ||
/** Returns a function that will call all functions in the reversed order with the same arguments. */ | ||
export declare function reverse_chain<Args extends [] | any[]>(callbacks: (((...args: Args) => any) | undefined)[]): (...args: Args) => void; | ||
//# sourceMappingURL=misc.d.ts.map |
@@ -5,29 +5,17 @@ /** no operation */ | ||
export const false_fn = () => false; | ||
/** | ||
* `a ^ b` | ||
*/ | ||
/** `a ^ b` */ | ||
export function xor(a, b) { | ||
return a ? !b : b; | ||
} | ||
/** | ||
* Get entries of an object | ||
*/ | ||
/** Get entries of an object */ | ||
export const entries = Object.entries; | ||
/** | ||
* Get keys of an object | ||
*/ | ||
/** Get keys of an object */ | ||
export const keys = Object.keys; | ||
/** | ||
* Converts any value to an Error. | ||
*/ | ||
/** Converts any value to an Error. */ | ||
export function toError(e) { | ||
return e instanceof Error ? e : new Error(String(e)); | ||
} | ||
/** | ||
* Check if a value is a PlainObject. A PlainObject is an object with no prototype. | ||
*/ | ||
/** Check if a value is a PlainObject. A PlainObject is an object with no prototype. */ | ||
export const is_plain_object = (value) => (value && Object.getPrototypeOf(value) === Object.prototype); | ||
/** | ||
* Check if the value is an instance of ___ | ||
*/ | ||
/** Check if the value is an instance of ___ */ | ||
export const is_of_class = (v, c) => v instanceof c || (v && v.constructor === c); | ||
@@ -41,3 +29,4 @@ /** | ||
/** | ||
* Returns a function that will call all functions in the order they were chained with the same arguments. | ||
* Returns a function that will call all functions in the order they were chained with the same | ||
* arguments. | ||
*/ | ||
@@ -50,5 +39,3 @@ export function chain(callbacks) { | ||
} | ||
/** | ||
* Returns a function that will call all functions in the reversed order with the same arguments. | ||
*/ | ||
/** Returns a function that will call all functions in the reversed order with the same arguments. */ | ||
export function reverse_chain(callbacks) { | ||
@@ -55,0 +42,0 @@ return (...args) => { |
@@ -11,11 +11,16 @@ export declare function random(max: number): number; | ||
/** | ||
* Linear interpolation | ||
* @param start Start value | ||
* @param end End value | ||
* @param t Interpolation factor | ||
* | ||
* ```ts | ||
* start + (end - start) * t | ||
* ``` | ||
*/ | ||
Because sometimes `n - Number.EPSILON == n` | ||
*/ | ||
export declare function find_open_upper_bound(max: number): number; | ||
/** | ||
Linear interpolation | ||
@param start Start value | ||
@param end End value | ||
@param t Interpolation factor | ||
```ts | ||
start + (end - start) * t | ||
``` | ||
*/ | ||
export declare function lerp(start: number, end: number, t: number): number; | ||
@@ -25,4 +30,4 @@ export declare function map_range(value: number, in_min: number, in_max: number, out_min: number, out_max: number): number; | ||
/** | ||
* Symmetric round | ||
* see https://www.npmjs.com/package/round-half-up-symmetric#user-content-detailed-background | ||
* Symmetric round see | ||
* https://www.npmjs.com/package/round-half-up-symmetric#user-content-detailed-background | ||
* | ||
@@ -45,9 +50,9 @@ * @param a value to round | ||
/** | ||
* Tests whether or not the arguments have approximately the same value, within an absolute | ||
* or relative tolerance of Number.EPSILON (an absolute tolerance is used for values less | ||
* than or equal to 1.0, and a relative tolerance is used for larger values) | ||
* Tests whether or not the arguments have approximately the same value, within an absolute or | ||
* relative tolerance of Number.EPSILON (an absolute tolerance is used for values less than or equal | ||
* to 1.0, and a relative tolerance is used for larger values) | ||
* | ||
* @param a The first number to test. | ||
* @param b The second number to test. | ||
* @returns True if the numbers are approximately equal, false otherwise. | ||
* @param a The first number to test. | ||
* @param b The second number to test. | ||
* @returns True if the numbers are approximately equal, false otherwise. | ||
*/ | ||
@@ -54,0 +59,0 @@ export declare function equals(a: number, b: number): boolean; |
@@ -30,11 +30,21 @@ export function random(max) { | ||
/** | ||
* Linear interpolation | ||
* @param start Start value | ||
* @param end End value | ||
* @param t Interpolation factor | ||
* | ||
* ```ts | ||
* start + (end - start) * t | ||
* ``` | ||
*/ | ||
Because sometimes `n - Number.EPSILON == n` | ||
*/ | ||
export function find_open_upper_bound(max) { | ||
let m = 0, n = max; | ||
while (max === n) | ||
n = max - Number.EPSILON * (++m); | ||
return n; | ||
} | ||
/** | ||
Linear interpolation | ||
@param start Start value | ||
@param end End value | ||
@param t Interpolation factor | ||
```ts | ||
start + (end - start) * t | ||
``` | ||
*/ | ||
export function lerp(start, end, t) { | ||
@@ -50,4 +60,4 @@ return start + (end - start) * t; | ||
/** | ||
* Symmetric round | ||
* see https://www.npmjs.com/package/round-half-up-symmetric#user-content-detailed-background | ||
* Symmetric round see | ||
* https://www.npmjs.com/package/round-half-up-symmetric#user-content-detailed-background | ||
* | ||
@@ -77,9 +87,9 @@ * @param a value to round | ||
/** | ||
* Tests whether or not the arguments have approximately the same value, within an absolute | ||
* or relative tolerance of Number.EPSILON (an absolute tolerance is used for values less | ||
* than or equal to 1.0, and a relative tolerance is used for larger values) | ||
* Tests whether or not the arguments have approximately the same value, within an absolute or | ||
* relative tolerance of Number.EPSILON (an absolute tolerance is used for values less than or equal | ||
* to 1.0, and a relative tolerance is used for larger values) | ||
* | ||
* @param a The first number to test. | ||
* @param b The second number to test. | ||
* @returns True if the numbers are approximately equal, false otherwise. | ||
* @param a The first number to test. | ||
* @param b The second number to test. | ||
* @returns True if the numbers are approximately equal, false otherwise. | ||
*/ | ||
@@ -86,0 +96,0 @@ export function equals(a, b) { |
export interface AnimationLoop { | ||
/** | ||
* User callback to be called on each animation frame. | ||
*/ | ||
/** User callback to be called on each animation frame. */ | ||
callback: FrameRequestCallback; | ||
/** | ||
* {@link loopFrame} bound to this loop. | ||
*/ | ||
/** {@link loopFrame} bound to this loop. */ | ||
frame: FrameRequestCallback; | ||
/** | ||
* The current frame id returned by {@link requestAnimationFrame}. | ||
*/ | ||
/** The current frame id returned by {@link requestAnimationFrame}. */ | ||
frame_id: number; | ||
@@ -24,3 +18,3 @@ } | ||
} | ||
export declare const frameIterationsLimit: (target_fps?: number) => FrameIterationsLimit; | ||
export declare function frameIterationsLimit(target_fps?: number): FrameIterationsLimit; | ||
export declare function calcIterations(limit: FrameIterationsLimit, current_time: number): number; | ||
@@ -27,0 +21,0 @@ export interface AlphaUpdateSteps { |
@@ -22,10 +22,12 @@ import { num } from "./index.js"; | ||
export const DEFAULT_TARGET_FPS = 44; | ||
export const frameIterationsLimit = (target_fps = DEFAULT_TARGET_FPS) => ({ | ||
target_fps, | ||
last_timestamp: performance.now(), | ||
}); | ||
export function frameIterationsLimit(target_fps = DEFAULT_TARGET_FPS) { | ||
return { | ||
target_fps, | ||
last_timestamp: performance.now(), | ||
}; | ||
} | ||
export function calcIterations(limit, current_time) { | ||
const target_ms = 1000 / limit.target_fps; | ||
const delta_time = current_time - limit.last_timestamp; | ||
const times = Math.floor(delta_time / target_ms); | ||
let target_ms = 1000 / limit.target_fps; | ||
let delta_time = current_time - limit.last_timestamp; | ||
let times = Math.floor(delta_time / target_ms); | ||
limit.last_timestamp += times * target_ms; | ||
@@ -32,0 +34,0 @@ return times; |
@@ -8,5 +8,3 @@ import type { Position } from "./types.js"; | ||
export type Vector_String = `(${number}, ${number})`; | ||
/** | ||
* Represents a 2D vector with x and y components. | ||
*/ | ||
/** Represents a 2D vector with x and y components. */ | ||
export declare class Vector { | ||
@@ -17,12 +15,11 @@ x: number; | ||
* Creates a new vector instance. | ||
* | ||
* @param str - A string in the format `(${number}, ${number})`. | ||
* | ||
* OR | ||
* | ||
* OR | ||
* @param vec - A Point object to copy the x and y components from. | ||
* | ||
* OR | ||
* | ||
* @param x - The x-component of the vector. | ||
* @param y - The y-component of the vector. | ||
* OR | ||
* @param x - The x-component of the vector. | ||
* @param y - The y-component of the vector. | ||
*/ | ||
@@ -36,5 +33,3 @@ constructor(str: Vector_String); | ||
} | ||
/** | ||
* Creates a new vector instance. | ||
*/ | ||
/** Creates a new vector instance. */ | ||
export declare const vector: { | ||
@@ -45,27 +40,21 @@ (str: Vector_String): Vector; | ||
}; | ||
/** | ||
* A constant vector representing the zero vector. | ||
*/ | ||
/** A constant vector representing the zero vector. */ | ||
export declare const ZERO: Vector; | ||
/** | ||
* Creates a new vector instance representing the zero vector. | ||
* | ||
* @returns A vector instance representing the zero vector. | ||
*/ | ||
export declare function zero(): Vector; | ||
/** | ||
* Checks if two vectors are equal. | ||
*/ | ||
/** Checks if two vectors are equal. */ | ||
export declare function equals(a: Position, b: Position): boolean; | ||
/** | ||
* Subtracts a vector from another vector in place. The first vector is **mutated**. | ||
*/ | ||
/** Subtracts a vector from another vector in place. The first vector is **mutated**. */ | ||
export declare function subtract(a: Position, b: Position): void; | ||
/** | ||
* Calculates the difference between two vectors. | ||
* | ||
* @returns The difference vector. | ||
*/ | ||
export declare function difference(a: Position, b: Position): Vector; | ||
/** | ||
* Adds a vector or a force to another vector in place. The first vector is **mutated**. | ||
*/ | ||
/** Adds a vector or a force to another vector in place. The first vector is **mutated**. */ | ||
export declare function add(vec: Position, velocity: Position | Force | number): void; | ||
@@ -75,21 +64,19 @@ export declare function add(vec: Position, x: number, y: number): void; | ||
* Calculates the sum of two vectors. | ||
* | ||
* @returns The sum vector. | ||
*/ | ||
export declare function sum(a: Position, b: Position): Vector; | ||
/** | ||
* Multiplies a vector by another vector or a scalar in place. The first vector is **mutated**. | ||
*/ | ||
/** Multiplies a vector by another vector or a scalar in place. The first vector is **mutated**. */ | ||
export declare function multiply(a: Position, b: Position | number): void; | ||
/** | ||
* Calculates the product of two vectors. | ||
* | ||
* @returns The product vector. | ||
*/ | ||
export declare function product(a: Position, b: Position | number): Vector; | ||
/** | ||
* Divides a vector by another vector in place. The first vector is **mutated**. | ||
*/ | ||
/** Divides a vector by another vector in place. The first vector is **mutated**. */ | ||
export declare function divide(a: Position, b: Position): void; | ||
/** | ||
* Calculates the quotient of two vectors. | ||
* (The first vector is divided by the second vector.) | ||
* Calculates the quotient of two vectors. (The first vector is divided by the second vector.) | ||
* | ||
* @returns The quotient vector. | ||
@@ -102,2 +89,3 @@ */ | ||
* Calculates the distance between two vectors. | ||
* | ||
* @returns The distance between the vectors. | ||
@@ -109,2 +97,3 @@ */ | ||
* Calculates the angle between two vectors. | ||
* | ||
* @returns The angle between the vectors in radians. | ||
@@ -114,35 +103,30 @@ */ | ||
/** | ||
* Rotates the {@link point} vector by {@link rad} angle (origin is 0,0). | ||
* The first vector is **mutated**. | ||
* Rotates the {@link point} vector by {@link rad} angle (origin is 0,0). The first vector is | ||
* **mutated**. | ||
*/ | ||
export declare function rotate(point: Vector, rad: number): void; | ||
/** | ||
* Rotates the {@link point} vector around {@link origin} by {@link rad} angle. | ||
* The first vector is **mutated**. | ||
* @param point - The vector to rotate. | ||
* Rotates the {@link point} vector around {@link origin} by {@link rad} angle. The first vector is | ||
* **mutated**. | ||
* | ||
* @param point - The vector to rotate. | ||
* @param origin - The origin of the rotation. | ||
* @param rad - The angle of rotation in radians. | ||
* @param rad - The angle of rotation in radians. | ||
*/ | ||
export declare function rotate_around(point: Vector, origin: Vector, rad: number): void; | ||
/** | ||
* Represents a force with magnitude and angle in 2D space. | ||
*/ | ||
/** Represents a force with magnitude and angle in 2D space. */ | ||
export declare class Force { | ||
/** | ||
* The magnitude of the force. | ||
*/ | ||
/** The magnitude of the force. */ | ||
distance: number; | ||
/** | ||
* The angle of the force in radians. | ||
*/ | ||
/** The angle of the force in radians. */ | ||
angle: number; | ||
/** | ||
* Creates a new Force instance. | ||
* @param delta_x - The x-component of the vector representing the force. | ||
* @param delta_y - The y-component of the vector representing the force. | ||
* | ||
* OR | ||
* @param delta_x - The x-component of the vector representing the force. | ||
* @param delta_y - The y-component of the vector representing the force. | ||
* | ||
* OR | ||
* @param distance - The magnitude of the force. | ||
* @param angle - The angle of the force in radians. | ||
* @param angle - The angle of the force in radians. | ||
*/ | ||
@@ -153,5 +137,3 @@ constructor(delta_x: Vector, delta_y: Vector); | ||
} | ||
/** | ||
* Creates a new Force instance. | ||
*/ | ||
/** Creates a new Force instance. */ | ||
export declare const force: { | ||
@@ -161,11 +143,7 @@ (a: Vector, b: Vector): Force; | ||
}; | ||
/** | ||
* Converts a Force object to a vector object with x and y components. | ||
*/ | ||
/** Converts a Force object to a vector object with x and y components. */ | ||
export declare function force_to_vector(f: Force): Vector; | ||
export declare function force_to_vector(dist: number, ang: number): Vector; | ||
/** | ||
* Represents a line segment with two endpoints. | ||
*/ | ||
/** Represents a line segment with two endpoints. */ | ||
export type Segment = [Vector, Vector]; | ||
//# sourceMappingURL=trig.d.ts.map |
@@ -1,4 +0,2 @@ | ||
/** | ||
* Represents a 2D vector with x and y components. | ||
*/ | ||
/** Represents a 2D vector with x and y components. */ | ||
export class Vector { | ||
@@ -31,12 +29,9 @@ x; | ||
} | ||
/** | ||
* Creates a new vector instance. | ||
*/ | ||
/** Creates a new vector instance. */ | ||
export const vector = (...args) => new Vector(...args); | ||
/** | ||
* A constant vector representing the zero vector. | ||
*/ | ||
/** A constant vector representing the zero vector. */ | ||
export const ZERO = vector(0, 0); | ||
/** | ||
* Creates a new vector instance representing the zero vector. | ||
* | ||
* @returns A vector instance representing the zero vector. | ||
@@ -47,11 +42,7 @@ */ | ||
} | ||
/** | ||
* Checks if two vectors are equal. | ||
*/ | ||
/** Checks if two vectors are equal. */ | ||
export function equals(a, b) { | ||
return a.x === b.x && a.y === b.y; | ||
} | ||
/** | ||
* Subtracts a vector from another vector in place. The first vector is **mutated**. | ||
*/ | ||
/** Subtracts a vector from another vector in place. The first vector is **mutated**. */ | ||
export function subtract(a, b) { | ||
@@ -63,2 +54,3 @@ a.x -= b.x; | ||
* Calculates the difference between two vectors. | ||
* | ||
* @returns The difference vector. | ||
@@ -83,2 +75,3 @@ */ | ||
* Calculates the sum of two vectors. | ||
* | ||
* @returns The sum vector. | ||
@@ -89,5 +82,3 @@ */ | ||
} | ||
/** | ||
* Multiplies a vector by another vector or a scalar in place. The first vector is **mutated**. | ||
*/ | ||
/** Multiplies a vector by another vector or a scalar in place. The first vector is **mutated**. */ | ||
export function multiply(a, b) { | ||
@@ -104,2 +95,3 @@ if (typeof b === "number") { | ||
* Calculates the product of two vectors. | ||
* | ||
* @returns The product vector. | ||
@@ -113,5 +105,3 @@ */ | ||
} | ||
/** | ||
* Divides a vector by another vector in place. The first vector is **mutated**. | ||
*/ | ||
/** Divides a vector by another vector in place. The first vector is **mutated**. */ | ||
export function divide(a, b) { | ||
@@ -122,4 +112,4 @@ a.x /= b.x; | ||
/** | ||
* Calculates the quotient of two vectors. | ||
* (The first vector is divided by the second vector.) | ||
* Calculates the quotient of two vectors. (The first vector is divided by the second vector.) | ||
* | ||
* @returns The quotient vector. | ||
@@ -139,2 +129,3 @@ */ | ||
* Calculates the distance between two vectors. | ||
* | ||
* @returns The distance between the vectors. | ||
@@ -157,2 +148,3 @@ */ | ||
* Calculates the angle between two vectors. | ||
* | ||
* @returns The angle between the vectors in radians. | ||
@@ -164,4 +156,4 @@ */ | ||
/** | ||
* Rotates the {@link point} vector by {@link rad} angle (origin is 0,0). | ||
* The first vector is **mutated**. | ||
* Rotates the {@link point} vector by {@link rad} angle (origin is 0,0). The first vector is | ||
* **mutated**. | ||
*/ | ||
@@ -174,7 +166,8 @@ export function rotate(point, rad) { | ||
/** | ||
* Rotates the {@link point} vector around {@link origin} by {@link rad} angle. | ||
* The first vector is **mutated**. | ||
* @param point - The vector to rotate. | ||
* Rotates the {@link point} vector around {@link origin} by {@link rad} angle. The first vector is | ||
* **mutated**. | ||
* | ||
* @param point - The vector to rotate. | ||
* @param origin - The origin of the rotation. | ||
* @param rad - The angle of rotation in radians. | ||
* @param rad - The angle of rotation in radians. | ||
*/ | ||
@@ -186,13 +179,7 @@ export function rotate_around(point, origin, rad) { | ||
} | ||
/** | ||
* Represents a force with magnitude and angle in 2D space. | ||
*/ | ||
/** Represents a force with magnitude and angle in 2D space. */ | ||
export class Force { | ||
/** | ||
* The magnitude of the force. | ||
*/ | ||
/** The magnitude of the force. */ | ||
distance; | ||
/** | ||
* The angle of the force in radians. | ||
*/ | ||
/** The angle of the force in radians. */ | ||
angle; | ||
@@ -214,5 +201,3 @@ constructor(a, b) { | ||
} | ||
/** | ||
* Creates a new Force instance. | ||
*/ | ||
/** Creates a new Force instance. */ | ||
export const force = (...args) => new Force(...args); | ||
@@ -219,0 +204,0 @@ export function force_to_vector(dist, ang) { |
@@ -1,4 +0,2 @@ | ||
/** | ||
* Can be single or in an array | ||
*/ | ||
/** Can be single or in an array */ | ||
export type Many<T> = T | T[]; | ||
@@ -15,5 +13,3 @@ export type AnyObject = Record<PropertyKey, any>; | ||
export type Falsy<T> = Extract<T, FalsyValue>; | ||
/** | ||
* Represents a point in 2D space with x and y coordinates. | ||
*/ | ||
/** Represents a point in 2D space with x and y coordinates. */ | ||
export interface Position { | ||
@@ -27,5 +23,3 @@ x: number; | ||
} | ||
/** | ||
* Infers the type of the array elements | ||
*/ | ||
/** Infers the type of the array elements */ | ||
export type ItemsOf<T> = T extends any[] ? T[number] : T; | ||
@@ -38,3 +32,6 @@ /** Allows to make shallow overwrites to an interface */ | ||
} & (A extends AnyObject ? Omit<B, keyof A> : A); | ||
/** Makes each property optional and turns each leaf property into any, allowing for type overrides by narrowing any. */ | ||
/** | ||
* Makes each property optional and turns each leaf property into any, allowing for type overrides | ||
* by narrowing any. | ||
*/ | ||
export type DeepPartialAny<T> = { | ||
@@ -74,3 +71,6 @@ [P in keyof T]?: T[P] extends AnyObject ? DeepPartialAny<T[P]> : any; | ||
* @example | ||
* | ||
* ```ts | ||
* Enumerate<3> // 0 | 1 | 2 | ||
* ``` | ||
*/ | ||
@@ -80,4 +80,8 @@ export type Enumerate<N extends number, Acc extends number[] = []> = Acc["length"] extends N ? Acc[number] : Enumerate<N, [...Acc, Acc["length"]]>; | ||
* Remove the first item of a tuple | ||
* | ||
* @example | ||
* [1, 2, 3, 4] => [2, 3, 4] | ||
* | ||
* ```ts | ||
* 1, 2, 3, 4 => [2, 3, 4] | ||
* ``` | ||
*/ | ||
@@ -87,4 +91,8 @@ export type Tail<T extends any[]> = ((...t: T) => void) extends (x: any, ...u: infer U) => void ? U : never; | ||
* Get the first item of a tuple | ||
* | ||
* @example | ||
* [1, 2, 3, 4] => 1 | ||
* | ||
* ```ts | ||
* 1, 2, 3, 4 => 1 | ||
* ``` | ||
*/ | ||
@@ -94,4 +102,8 @@ export type Head<T extends any[]> = T extends [any, ...any[]] ? T[0] : never; | ||
* Get the last item of a tuple | ||
* | ||
* @example | ||
* [1, 2, 3, 4] => 4 | ||
* | ||
* ```ts | ||
* 1, 2, 3, 4 => 4 | ||
* ``` | ||
*/ | ||
@@ -101,4 +113,8 @@ export type Last<T extends any[]> = T extends [...any[], infer L] ? L : never; | ||
* Remove the last item of a tuple | ||
* | ||
* @example | ||
* [1, 2, 3, 4] => [1, 2, 3] | ||
* | ||
* ```ts | ||
* 1, 2, 3, 4 => [1, 2, 3] | ||
* ``` | ||
*/ | ||
@@ -108,5 +124,8 @@ export type ButLast<T extends any[]> = T extends [...infer U, any] ? U : never; | ||
* Exclude items from the end of a tuple that match a type | ||
* | ||
* @example | ||
* ExcludeEnd<[1, 2, 3, 4], 4> => [1, 2, 3] | ||
* ExcludeEnd<[1, 2, 3, 4], 3 | 4> => [1, 2] | ||
* | ||
* ```ts | ||
* ExcludeEnd<[1, 2, 3, 4], 4> => [1, 2, 3] ExcludeEnd<[1, 2, 3, 4], 3 | 4> => [1, 2] | ||
* ``` | ||
*/ | ||
@@ -113,0 +132,0 @@ export type ExcludeEnd<T extends any[], U> = T extends [...infer V, U] ? ExcludeEnd<V, U> : T; |
{ | ||
"name": "@nothing-but/utils", | ||
"version": "0.14.0", | ||
"license": "MIT", | ||
"author": "Damian Tarnawski <gthetarnav@gmail.com>", | ||
"contributors": [], | ||
"homepage": "https://github.com/thetarnav/nothing-but/tree/main/packages/utils#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/thetarnav/nothing-but.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/thetarnav/nothing-but/issues" | ||
}, | ||
"private": false, | ||
"sideEffects": false, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"type": "module", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"browser": {}, | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
}, | ||
"./*": { | ||
"import": { | ||
"types": "./dist/*.d.ts", | ||
"default": "./dist/*.js" | ||
} | ||
} | ||
}, | ||
"scripts": { | ||
"build": "pnpm tsc -p ./tsconfig.build.json", | ||
"prepublish": "pnpm build", | ||
"test": "vitest -c ../../configs/vitest.config.js", | ||
"typecheck": "echo \"Built with TSC\"" | ||
} | ||
} | ||
"name": "@nothing-but/utils", | ||
"version": "0.15.0", | ||
"license": "MIT", | ||
"author": "Damian Tarnawski <gthetarnav@gmail.com>", | ||
"contributors": [], | ||
"homepage": "https://github.com/thetarnav/nothing-but/tree/main/packages/utils#readme", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/thetarnav/nothing-but.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/thetarnav/nothing-but/issues" | ||
}, | ||
"scripts": { | ||
"build": "pnpm tsc -p ./tsconfig.build.json", | ||
"prepublish": "pnpm build", | ||
"test": "vitest -c ../../configs/vitest.config.js", | ||
"typecheck": "echo \"Built with TSC\"" | ||
}, | ||
"private": false, | ||
"sideEffects": false, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"type": "module", | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"browser": {}, | ||
"exports": { | ||
".": { | ||
"import": { | ||
"types": "./dist/index.d.ts", | ||
"default": "./dist/index.js" | ||
} | ||
}, | ||
"./*": { | ||
"import": { | ||
"types": "./dist/*.d.ts", | ||
"default": "./dist/*.js" | ||
} | ||
} | ||
} | ||
} |
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
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
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
Sorry, the diff of this file is not supported yet
105602
44
2239