@thi.ng/vectors
Version:
Optimized 2d/3d/4d and arbitrary length vector operations, support for memory mapping/layouts
49 lines • 1.38 kB
TypeScript
import type { Stringer } from "@thi.ng/strings";
import type { ToStringOpts } from "./api.js";
/**
* Returns a new generic vector formatter for given options (all optional). The
* returned function accepts a single vector(like) value and returns its
* formatted string representation.
*
* @remarks
* See {@link ToStringOpts} for further details. Also see {@link FORMATTER} and
* {@link setFormat} to set default formatter.
*
* @example
* ```ts tangle:../export/def-format.ts
* import { defFormat } from "@thi.ng/vectors";
*
* console.log(
* defFormat()([1, -2, 3])
* );
* // [1.000, -2.000, 3.000]
*
* console.log(
* defFormat({ width: 10, wrap: "||", delim: "|\n|" })([1, -2, 3])
* );
* // | 1.000|
* // | -2.000|
* // | 3.000|
*
* console.log(
* defFormat({ prec: 5, delim: " " })([1, -2, 3])
* );
* // [1.00000 -2.00000 3.00000]
* ```
*
* @param prec -
* @param width -
*/
export declare const defFormat: (opts?: Partial<ToStringOpts>) => Stringer<Iterable<number>>;
/**
* Sets package-wide default vector formatter. See {@link defFormat},
* {@link FORMATTER}.
*
* @param fmt -
*/
export declare const setFormat: (fmt: Stringer<Iterable<number>> | Partial<ToStringOpts>) => void;
/**
* Package-wide default vector formatter.
*/
export declare let FORMATTER: Stringer<Iterable<number>>;
//# sourceMappingURL=string.d.ts.map