From e779a7c1eb3e2a5e87c33bcd38971839214b878a Mon Sep 17 00:00:00 2001 From: Lloyd Brookes Date: Sun, 4 Jul 2021 14:10:33 +0100 Subject: [PATCH] add options.locale to docs --- README.md | 1 + index.mjs | 1 + jsdoc.conf | 5 +++++ package.json | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 jsdoc.conf diff --git a/README.md b/README.md index 3fbf654..b6bc22b 100644 --- a/README.md +++ b/README.md @@ -150,6 +150,7 @@ Returns an object with the spec `{ value: string, unit: string, long: string }`. | [options.units] | string | Specify `'metric'`, `'iec'`, `'metric_octet'`, `'iec_octet'` or the name of a property from the custom units table in `options.customUnits`. Defaults to `metric`. | | [options.customUnits] | object | An object containing one or more custom unit lookup tables. | | [options.toStringFn] | function | A `toString` function to override the default. | +| [options.locale] | string \| Array.<string> | The locale to use for number formatting (e.g. `'de-DE'`). Defaults to your system locale. Passed directed into [Intl.NumberFormat()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat). | diff --git a/index.mjs b/index.mjs index 86a17ea..bd219cd 100644 --- a/index.mjs +++ b/index.mjs @@ -104,6 +104,7 @@ class ByteSize { * @param [options.units] {string} - Specify `'metric'`, `'iec'`, `'metric_octet'`, `'iec_octet'` or the name of a property from the custom units table in `options.customUnits`. Defaults to `metric`. * @param [options.customUnits] {object} - An object containing one or more custom unit lookup tables. * @param [options.toStringFn] {function} - A `toString` function to override the default. + * @param [options.locale] {string|string[]} - The locale to use for number formatting (e.g. `'de-DE'`). Defaults to your system locale. Passed directed into [Intl.NumberFormat()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat). * @returns {object} * @alias module:byte-size */ diff --git a/jsdoc.conf b/jsdoc.conf new file mode 100644 index 0000000..15d1b97 --- /dev/null +++ b/jsdoc.conf @@ -0,0 +1,5 @@ +{ + "source": { + "includePattern": ".+\\.(js(doc|x)?|mjs)$" + } +} diff --git a/package.json b/package.json index ba1265d..fc1714f 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "test": "npm run dist && npm run test:esm && npm run test:web", "test:esm": "test-runner --view.hide-skips test.mjs", "test:web": "web-runner test.mjs", - "docs": "jsdoc2md -t README.hbs dist/index.js > README.md", + "docs": "jsdoc2md -c jsdoc.conf -t README.hbs index.mjs > README.md", "cover": "c8 npm test && c8 report --reporter=text-lcov | coveralls", "dist": "rollup -c" },