es-next-tools
Version:
A comprehensive utility library for JavaScript and TypeScript that provides a wide range of functions for common programming tasks, including mathematical operations, date manipulations, array and object handling, string utilities, and more.
16 lines (15 loc) • 437 B
TypeScript
/**
* Calculates the Euclidean distance between two points.
* @param {Point} p - The first point
* @param {Point} q - The second point.
* @returns The Euclidean distance between the two points.
* @example
* dist([1, 2], [4, 6]); // 5
*/
export declare function dist(p: Point, q: Point): number;
/**
* A tuple representing a point in 2D space.
* @example
* const point: Point = [1, 2];
*/
export type Point = [number, number];