@types/parse-decimal-number
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Installation

npm install --save @types/parse-decimal-number

Summary

This package contains type definitions for parse-decimal-number (https://github.com/AndreasPizsa/parse-decimal-number).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse-decimal-number.

index.d.ts

declare namespace parseDecimalNumber {
    type ArrayOptions = [thousands: string, decimal: string];

    interface HashOptions {
        /**
         * Decimal point character.
         * Default: ".".
         */
        decimal: string;
        /**
         * Thousands separator character.
         * Default: ",".
         */
        thousands: string;
    }

    type Options = ArrayOptions | HashOptions | string;

    /**
     * Has the same effect as `parseDecimalNumber.setOptions({ thousands: ",", decimal: "." })`.
     */
    function factoryReset(): void;
    /**
     * Set the default thousands and decimal characters that are used when no options are passed to
     * {@link parseDecimalNumber}.
     */
    function setOptions(hash: HashOptions): void;
    /**
     * Returns a function that will take a string as an argument and return a float or `NaN`,
     * just like {@link parseDecimalNumber}.
     */
    function withOptions(options: Options, enforceGroupSize?: boolean): (string: string) => number;
}

declare function parseDecimalNumber(
    /**
     * A string that is supposed to contain a number.
     */
    string: string,
    /**
     * A string, array or hash with thousands and decimal separators.
     */
    options?: parseDecimalNumber.Options,
    /**
     * A boolean indicating whether to support that individual groups between the thousands
     * character are exactly 3 digits.
     */
    enforceGroupSize?: boolean,
): number;

export = parseDecimalNumber;

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: none

Credits

These definitions were written by Ciarán Ingle.

Dependents (0)

Package Sidebar

Install

npm i @types/parse-decimal-number

Weekly Downloads

8,106

Version

1.0.2

License

MIT

Unpacked Size

5.65 kB

Total Files

5

Last publish

Collaborators

  • types