earthmc
Version:
An unofficial EarthMC library providing handy methods and extensive info.
38 lines • 2.27 kB
TypeScript
import type { Point2D, RawPlayer, Town, BaseTown, BaseNation, StrictPoint2D, OnlinePlayer } from '../types/index.js';
export declare const fastMerge: <T>(original: T[], args: T[]) => T[];
export declare const fastMergeUnique: <T>(original: T[], args: T[]) => T[];
export declare const stripInvalidChars: (str: string) => string;
export declare function formatString(str: string, removeAccents?: boolean): string;
export declare function editPlayerProps(props: RawPlayer[]): {
name: string;
nickname?: string;
underground?: boolean;
world?: string;
x: number | string;
z: number | string;
y?: number | string;
}[];
export declare const editPlayerProp: (player: RawPlayer) => OnlinePlayer;
export declare const roundToNearest16: (num: number) => number;
export declare function calcArea(X: number[], Z: number[], numPoints: number, divisor?: number): number;
export declare function calcAreaPoints(points: StrictPoint2D[], divisor?: number): number;
export declare function averageNationPos(name: string, towns: Town[]): "Error getting average position: 'towns' parameter not defined!" | {
x: number;
z: number;
};
export declare function getAveragePos(arr: Point2D[]): "Error getting average position: 'towns' parameter not defined!" | {
x: number;
z: number;
};
export declare const safeParseInt: (num: number | string) => number;
export declare const asBool: (str: string) => str is "true";
export declare const midrange: (args: number[]) => number;
export declare const sqr: (a: Point2D, b: Point2D, range: number) => boolean;
export declare const average: (nums: Point2D[], key: keyof Point2D) => number;
export declare const getExisting: <T>(a1: T[], a2: string[], key: keyof T) => (import("./errors.js").NotFoundError | T)[];
export declare const hypot: (num: number, args: [input: number, radius: number]) => boolean;
export declare const manhattan: (x1: number, z1: number, x2: number, z2: number) => number;
export declare const euclidean: (x1: number, z1: number, x2: number, z2: number) => number;
export declare const strictFalsy: (val: any) => boolean;
export declare const isInvitable: (town: BaseTown, nation: BaseNation, range: number, belonging: boolean) => boolean;
//# sourceMappingURL=functions.d.ts.map