/** * Typed String Formatting Functions * * Polymorphic string-formatting operations using typed-function for runtime dispatch. * Supports `number`, `BigNumber`, and `string` types as appropriate for each op. * * These are clean implementations using mathTyped dispatch — the activated * mathjs-derived layer under functions/src/string/ is left untouched here * and used only as an algorithm reference. * * Semantics follow the mathjs convention: * - bin/hex/oct: sign-magnitude representation for negative numbers (NOT two's-complement), * e.g. bin(-5) === '-0b101', hex(-5) === '-0x5'. * (Two's-complement only applies when the optional wordSize argument is used.) * - format: delegates to utils/string.ts `format()` which dispatches on number vs * BigNumber, with full options-object support (notation, precision, lowerExp, upperExp, etc.) * - print: replaces $key / $key.nested placeholders in a template string using * values from a supplied object or array. * * @packageDocumentation */ /** * Format a number as binary. * * Negative numbers use sign-magnitude notation (e.g. -5 → '-0b101'). * When the optional `wordSize` argument is supplied the value is * formatted as a signed two's-complement integer of that many bits * and a size suffix ('i') is appended. * * @example * ```typescript * bin(2) // '0b10' * bin(255) // '0b11111111' * bin(-5) // '-0b101' * bin(0) // '0b0' * ``` */ export declare const bin: import("@danielsimonjr/mathts-core").TypedFunction; /** * Format a number as hexadecimal. * * Negative numbers use sign-magnitude notation (e.g. -5 → '-0x5'). * When the optional `wordSize` argument is supplied the value is * formatted as a signed two's-complement integer of that many bits. * * @example * ```typescript * hex(255) // '0xff' * hex(-5) // '-0x5' * hex(0) // '0x0' * ``` */ export declare const hex: import("@danielsimonjr/mathts-core").TypedFunction; /** * Format a number as octal. * * Negative numbers use sign-magnitude notation (e.g. -8 → '-0o10'). * When the optional `wordSize` argument is supplied the value is * formatted as a signed two's-complement integer of that many bits. * * @example * ```typescript * oct(8) // '0o10' * oct(-8) // '-0o10' * oct(0) // '0o0' * ``` */ export declare const oct: import("@danielsimonjr/mathts-core").TypedFunction; /** * Format a value of any type into a string. * * When called with a plain number or BigNumber it delegates to the lower-level * `utils/string.ts` formatter which supports the full options object: * `{ notation, precision, lowerExp, upperExp, fraction, truncate }`. * * Passing a positional number as the second argument is shorthand for * `{ precision: n }`. * * @example * ```typescript * format(3.14159, 3) // '3.14' * format(0.0001, { precision: 2 }) // '1e-4' * format(12400, { notation: 'engineering' }) // '12.4e+3' * format(Infinity) // 'Infinity' * format(NaN) // 'NaN' * ``` */ export declare const format: import("@danielsimonjr/mathts-core").TypedFunction; /** * Interpolate values into a string template. * * Placeholders have the form `$key` or `$key.nested`. Array indices are * accessed as `$0`, `$1`, etc. Non-string values are converted using `format`. * * @example * ```typescript * print('Hello $name!', { name: 'World' }) // 'Hello World!' * print('Lucy is $age years old', { age: 5 }) // 'Lucy is 5 years old' * print('$0 and $1', ['apples', 'bananas']) // 'apples and bananas' * print('pi ≈ $pi', { pi: Math.PI }, 4) // 'pi ≈ 3.142' * ``` */ export declare const print: import("@danielsimonjr/mathts-core").TypedFunction; /** * All typed string-formatting functions. */ export declare const typedString: { bin: import("@danielsimonjr/mathts-core").TypedFunction; hex: import("@danielsimonjr/mathts-core").TypedFunction; oct: import("@danielsimonjr/mathts-core").TypedFunction; format: import("@danielsimonjr/mathts-core").TypedFunction; print: import("@danielsimonjr/mathts-core").TypedFunction; }; //# sourceMappingURL=string.d.ts.map