@lou.codes/parsers
Version:
👁️🗨️ Parsers without nonsense
22 lines (21 loc) • 554 B
TypeScript
/**
* Parses a `string` to a decimal `number`.
*
* @category Number
* @remarks
* Parses a `string` to a decimal `number`, returning `undefined` instead of
* `NaN` if it fails.
* @example
* ```typescript
* parseDecimal("101"); // 101
* parseDecimal("101.5"); // 101
* parseDecimal("invalid"); // undefined
* ```
* @see {@link parseInteger}
*
* @param string String to be parsed.
* @returns Parsed `number` or `undefined` if it fails.
*/
export declare const parseDecimal: (
string: string,
) => import("@lou.codes/types").Maybe<number>;