-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
1,718 additions
and
1,469 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"extends": [ | ||
"airbnb-base", | ||
"airbnb-typescript/base", | ||
"prettier", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:import/typescript", | ||
"plugin:jest/all" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"jest" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 9, | ||
"project": "./tsconfig.json" | ||
}, | ||
"env": { | ||
"node": true, | ||
"jest": true | ||
}, | ||
"rules": { | ||
"@typescript-eslint/comma-dangle": "off", | ||
"import/prefer-default-export": "off", | ||
"jest/no-conditional-in-test": "off", | ||
"jest/no-hooks": "off", | ||
"jest/no-identical-title": "off", | ||
"jest/prefer-expect-assertions": "off" | ||
}, | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"**/*.ts" | ||
], | ||
"rules": { | ||
"no-undef": "off" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"trailingComma": "es5", | ||
"printWidth": 80, | ||
"useTabs": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"roots": ["<rootDir>/src"], | ||
"testEnvironment": "node", | ||
"transform": { | ||
"^.+\\.(t|j)sx?$": "ts-jest" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import 'zx/globals'; | ||
import "zx/globals"; | ||
|
||
async function main() { | ||
await $`rm -rf ./node_modules/.cache`; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import nf from './index'; | ||
import nf from "./index"; | ||
|
||
describe('bug reports', () => { | ||
it('shows mismatched values between nodejs and browser', () => { | ||
describe("bug reports", () => { | ||
it("shows mismatched values between nodejs and browser", () => { | ||
const value = 47_939; | ||
const actual = nf(value, '0.0a'); | ||
const actual = nf(value, "0.0a"); | ||
|
||
// const expected = '48K'; // chrome, firefox | ||
const expected = '47.9K'; // nodejs | ||
const expected = "47.9K"; // nodejs | ||
expect(actual).toBe(expected); | ||
}); | ||
|
||
it('respect number of fraction digits', () => { | ||
it("respect number of fraction digits", () => { | ||
const value = 123.4; | ||
const actual = nf(value, '0.00[0]'); | ||
const actual = nf(value, "0.00[0]"); | ||
|
||
const expected = '123.40'; | ||
const expected = "123.40"; | ||
expect(actual).toBe(expected); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { rgDigitsFormat } from './regex'; | ||
import { rgDigitsFormat } from "./regex"; | ||
|
||
export function getDigitsFormat(format?: string) { | ||
const [digitsFormat] = rgDigitsFormat.exec(format || '') || ['0,000']; | ||
const [digitsFormat] = rgDigitsFormat.exec(format || "") || ["0,000"]; | ||
|
||
if (digitsFormat === '0,0') return '0,000'; | ||
if (digitsFormat === "0,0") return "0,000"; | ||
|
||
return digitsFormat; | ||
} |
Oops, something went wrong.