Skip to content

Commit bcf9d6b

Browse files
committed
Move types description from settings.ts to types.d.ts
1 parent af5366f commit bcf9d6b

File tree

2 files changed

+35
-37
lines changed

2 files changed

+35
-37
lines changed

src/settings.ts

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,5 @@
11
import { Settings } from './types';
22

3-
/**
4-
* The library's settings configuration interface.
5-
*
6-
* @typedef {Object} Settings
7-
* @property {String} [symbol='$'] - Currency symbol
8-
* @property {String|CurrencyFormat} [format='%s%v'] - Controls output: %s = symbol, %v = value (can be object, see docs)
9-
* @property {String} [decimal='.'] - Decimal point separator
10-
* @property {String} [thousand=','] - Thousands separator
11-
* @property {Number} [precision=2] - Number of decimal places to round the amount to
12-
* @property {Number} [grouping=3] - Digit grouping (not implemented yet)
13-
* @property {Boolean} [stripZeros=false] - Strip insignificant zeros from decimal part
14-
* @property {Float} [fallback=0] - Value returned on unformat() failure
15-
* @property {Number} [round=0] - Decide round direction.
16-
*/
17-
18-
/**
19-
* Currency format interface.
20-
*
21-
* Each property represents template string used by formatMoney.
22-
* Inside this template you can use these patterns:
23-
* - **%s** - Currency symbol
24-
* - **%v** - Amount
25-
*
26-
* **Examples**:
27-
* ```js
28-
* '%s %v' => '$ 1.00'
29-
* '%s (%v)' => '$ (1.00)'
30-
* '%s -- ' => '$ --'
31-
* ```
32-
*
33-
* @typedef {Format} CurrencyFormat
34-
* @property {String} pos - Currency format for positive values
35-
* @property {String} [neg=pos] - Currency format for negative values
36-
* @property {String} [zero=pos] - Currency format for zero values
37-
*
38-
*/
39-
403
/**
414
* The library's default settings configuration object.
425
* Contains default parameters for currency and number formatting.

src/types.d.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,46 @@
11
export type NestedArray<T> = T | NestedArray<T>[];
22

3+
/**
4+
* Currency format interface.
5+
*
6+
* Each property represents template string used by formatMoney.
7+
* Inside this template you can use these patterns:
8+
* - **%s** - Currency symbol
9+
* - **%v** - Amount
10+
*
11+
* **Examples**:
12+
* ```js
13+
* '%s %v' => '$ 1.00'
14+
* '%s (%v)' => '$ (1.00)'
15+
* '%s -- ' => '$ --'
16+
* ```
17+
*
18+
* @typedef {Format} CurrencyFormat
19+
* @property {String} pos - Currency format for positive values
20+
* @property {String} [neg=pos] - Currency format for negative values
21+
* @property {String} [zero=pos] - Currency format for zero values
22+
*
23+
*/
324
export type CurrencyFormat = {
425
pos: string; // Currency format for positive values
526
neg?: string; // Currency format for negative values
627
zero?: string; // Currency format for zero values
728
};
829

30+
/**
31+
* The library's settings configuration interface.
32+
*
33+
* @typedef {Object} Settings
34+
* @property {String} [symbol='$'] - Currency symbol
35+
* @property {String|CurrencyFormat} [format='%s%v'] - Controls output: %s = symbol, %v = value (can be object, see docs)
36+
* @property {String} [decimal='.'] - Decimal point separator
37+
* @property {String} [thousand=','] - Thousands separator
38+
* @property {Number} [precision=2] - Number of decimal places to round the amount to
39+
* @property {Number} [grouping=3] - Digit grouping (not implemented yet)
40+
* @property {Boolean} [stripZeros=false] - Strip insignificant zeros from decimal part
41+
* @property {Float} [fallback=0] - Value returned on unformat() failure
42+
* @property {Number} [round=0] - Decide round direction.
43+
*/
944
export type Settings = {
1045
symbol?: string; // Currency symbol
1146
format?: string | CurrencyFormat; // Controls output: %s = symbol, %v = value (can be object, see docs)

0 commit comments

Comments
 (0)