Skip to content

Commit ae96356

Browse files
committed
chore: address v3 review follow-ups
1 parent 22fe538 commit ae96356

14 files changed

Lines changed: 10434 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
node-version: [18, 20, 22]
18+
node-version: [20, 22]
1919

2020
steps:
2121
- name: Checkout
@@ -27,11 +27,14 @@ jobs:
2727
node-version: ${{ matrix.node-version }}
2828

2929
- name: Install dependencies
30-
run: npm install --no-package-lock --no-audit --no-fund
30+
run: npm ci --no-audit --no-fund
3131

3232
- name: Run tests
3333
run: npm test
3434

35+
- name: Verify generated artifacts are up to date
36+
run: git diff --exit-code
37+
3538
all-checks-pass:
3639
name: all-checks-pass
3740
runs-on: ubuntu-latest

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ module.exports = function(grunt) {
213213

214214
grunt.config('string-replace.numeral', {
215215
files: {
216-
'src/numeral.js': 'src/numeral.js'
216+
'src/numeral.ts': 'src/numeral.ts'
217217
},
218218
options: {
219219
replacements: [

MIGRATION.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ Version `3.0.0` keeps the public runtime behavior from `2.0.x`, but modernizes t
66

77
### Breaking changes
88

9-
1. Node.js requirement is now `>=18`.
9+
1. Node.js requirement is now `>=20`.
1010
2. The project source of truth is now TypeScript in `src/**/*.ts`.
1111

1212
### Notable updates
1313

1414
1. First-party TypeScript declarations are bundled via `numeral.d.ts`.
15-
2. CI now runs on GitHub Actions against Node `18`, `20`, and `22`.
15+
2. CI now runs on GitHub Actions against Node `20` and `22`.
1616
3. Core build/test scripts now compile TypeScript before running Grunt tasks.
1717

1818
### New development commands

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A javascript library for formatting and manipulating numbers.
1212
# v3 Notes
1313

1414
1. `3.0.0` is a TypeScript rewrite with behavior preserved from `2.0.x`.
15-
2. Node.js support is now `>=18`.
15+
2. Node.js support is now `>=20`.
1616
3. First-party types are bundled in `numeral.d.ts`.
1717
4. See `MIGRATION.md` for upgrade details.
1818

@@ -61,13 +61,13 @@ See [the english unit tests](https://github.com/adamwdraper/Numeral-js/blob/mast
6161

6262
### 3.0.0
6363

64-
Breaking change: Node.js engines set to `>=18`
64+
Breaking change: Node.js engines set to `>=20`
6565

6666
Breaking change: Source of truth moved to TypeScript (`src/**/*.ts`)
6767

6868
Added: Bundled TypeScript types (`numeral.d.ts`)
6969

70-
Added: GitHub Actions CI for Node 18/20/22
70+
Added: GitHub Actions CI for Node 20/22
7171

7272
### 2.0.6
7373

locales.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@
771771
if (number === 0) { // special case for zero
772772
return '\'ıncı';
773773
}
774-
var a = number % 10, b = number % 100 - a, c = number >= 100 ? 100 : null;
774+
var a = number % 10, b = number % 100 - a, c = number >= 100 ? 100 : -1;
775775
return suffixes[a] || suffixes[b] || suffixes[c];
776776
},
777777
currency: {

locales/tr.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
if (number === 0) { // special case for zero
4848
return '\'ıncı';
4949
}
50-
var a = number % 10, b = number % 100 - a, c = number >= 100 ? 100 : null;
50+
var a = number % 10, b = number % 100 - a, c = number >= 100 ? 100 : -1;
5151
return suffixes[a] || suffixes[b] || suffixes[c];
5252
},
5353
currency: {

numeral.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
numeral._ = _ = {
8888
// formats numbers separators, decimals places, signs, abbreviations
8989
numberToFormat: function (value, format, roundingFunction) {
90-
var locale = locales[numeral.options.currentLocale], negP = false, optDec = false, leadingCount = 0, abbr = '', trillion = 1000000000000, billion = 1000000000, million = 1000000, thousand = 1000, decimal = '', neg = false, abbrForce, abs, int, precision, signed, thousands, output;
90+
var locale = locales[numeral.options.currentLocale], negP = false, optDec = false, leadingCount = 0, abbr = '', trillion = 1000000000000, billion = 1000000000, million = 1000000, thousand = 1000, decimal = '', neg = false, abbrForce, abs, int, precision, signed = -1, thousands, output;
9191
// make sure we never format a null value
9292
value = value || 0;
9393
abs = Math.abs(value);
@@ -307,7 +307,8 @@
307307
* problems for accounting- and finance-related software.
308308
*/
309309
toFixed: function (value, maxDecimals, roundingFunction, optionals) {
310-
var splitValue = value.toString().split('.'), minDecimals = maxDecimals - (optionals || 0), boundedPrecision, optionalsRegExp, power, output;
310+
optionals = optionals || 0;
311+
var splitValue = value.toString().split('.'), minDecimals = maxDecimals - optionals, boundedPrecision, optionalsRegExp, power, output;
311312
// Use the smallest precision value possible to avoid errors from floating point representation
312313
if (splitValue.length === 2) {
313314
boundedPrecision = Math.min(Math.max(splitValue[1].length, minDecimals), maxDecimals);

0 commit comments

Comments
 (0)