@d3plus/format 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# @d3plus/format
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@d3plus/format)
|
|
4
|
+
[](https://codecov.io/gh/d3plus/d3plus/flags)
|
|
5
|
+
|
|
3
6
|
JavaScript formatters for localized numbers and dates.
|
|
4
7
|
|
|
5
8
|
## Installing
|
|
@@ -40,7 +43,7 @@ Live examples can be found on [d3plus.org](https://d3plus.org/), which includes
|
|
|
40
43
|
|
|
41
44
|
> **format**(`specifier`: `string`): `Formatter`
|
|
42
45
|
|
|
43
|
-
Defined in: [format.ts:10](https://github.com/d3plus/d3plus/blob/
|
|
46
|
+
Defined in: [format.ts:10](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/format/src/format.ts#L10)
|
|
44
47
|
|
|
45
48
|
#### Parameters
|
|
46
49
|
|
|
@@ -60,7 +63,7 @@ Defined in: [format.ts:10](https://github.com/d3plus/d3plus/blob/e9db3c74352143c
|
|
|
60
63
|
|
|
61
64
|
> **formatAbbreviate**(`n`: `string` \| `number`, `locale?`: `string` \| `FormatLocaleDefinition`, `precision?`: `string`): `string`
|
|
62
65
|
|
|
63
|
-
Defined in: [formatAbbreviate.ts:55](https://github.com/d3plus/d3plus/blob/
|
|
66
|
+
Defined in: [formatAbbreviate.ts:55](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/format/src/formatAbbreviate.ts#L55)
|
|
64
67
|
|
|
65
68
|
Formats a number to an appropriate number of decimal places and rounding, adding suffixes if applicable (ie. `1200000` to `"1.2M"`).
|
|
66
69
|
|
|
@@ -84,7 +87,7 @@ Formats a number to an appropriate number of decimal places and rounding, adding
|
|
|
84
87
|
|
|
85
88
|
> **formatDate**(`d`: `Date`, `dataArray`: `Date`[], `formatter?`: `DateFormatter`): `string`
|
|
86
89
|
|
|
87
|
-
Defined in: [formatDate.ts:12](https://github.com/d3plus/d3plus/blob/
|
|
90
|
+
Defined in: [formatDate.ts:12](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/format/src/formatDate.ts#L12)
|
|
88
91
|
|
|
89
92
|
A default set of date formatters, which takes into account both the interval in between in each data point but also the start/end data points.
|
|
90
93
|
|
|
@@ -108,7 +111,7 @@ A default set of date formatters, which takes into account both the interval in
|
|
|
108
111
|
|
|
109
112
|
> **formatDefaultLocale**(`definition`: `FormatLocaleDefinition`): `Record`\<`string`, `unknown`\>
|
|
110
113
|
|
|
111
|
-
Defined in: [formatDefaultLocale.ts:8](https://github.com/d3plus/d3plus/blob/
|
|
114
|
+
Defined in: [formatDefaultLocale.ts:8](https://github.com/d3plus/d3plus/blob/fe174c3153bf379a226e4a41b6a8492a86c3a1b7/packages/format/src/formatDefaultLocale.ts#L8)
|
|
112
115
|
|
|
113
116
|
An extension to d3's [formatDefaultLocale](https://github.com/d3/d3-format#api-reference) function that allows setting the locale globally for formatters.
|
|
114
117
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d3plus/format",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "JavaScript formatters for localized numbers and dates.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,13 +38,14 @@
|
|
|
38
38
|
"d3-format": "^3.1.0",
|
|
39
39
|
"d3-time": "^3.1.0",
|
|
40
40
|
"d3-time-format": "^4.1.0",
|
|
41
|
-
"@d3plus/locales": "3.1.
|
|
41
|
+
"@d3plus/locales": "3.1.1"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build:esm": "node ../../scripts/build-esm.js",
|
|
45
45
|
"build:types": "tsc",
|
|
46
46
|
"build:umd": "node ../../scripts/build-umd.js",
|
|
47
47
|
"dev": "node ../../scripts/dev.js",
|
|
48
|
-
"test": "eslint index.ts src/**/*.ts && eslint --global=it test && mocha 'test/**/*-test.js'"
|
|
48
|
+
"test": "eslint index.ts src/**/*.ts && eslint --global=it test && mocha 'test/**/*-test.js'",
|
|
49
|
+
"test:coverage": "c8 -r text -r lcov --src src mocha 'test/**/*-test.js'"
|
|
49
50
|
}
|
|
50
51
|
}
|
package/umd/d3plus-format.js
CHANGED
package/umd/d3plus-format.min.js
CHANGED