Skip to content

Commit f32ca06

Browse files
authored
Merge pull request #6 from satotake/fix-api
fix(api): change main func name
2 parents 5d94255 + 8c869f1 commit f32ca06

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

__tests__/jp-numerals.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { jpNumerals, Numeral, NumeralZero } from '../src/jp-numerals'
1+
import { numerals, Numeral, NumeralZero } from '../src/jp-numerals'
22
import { JpNumeralUnit } from '../src/type'
33

44
describe('Numeral Class', () => {
@@ -54,7 +54,7 @@ describe('class NumeralZero', () => {
5454

5555
describe('jpNumerals', () => {
5656
it('can handle integer', () => {
57-
const n = jpNumerals(12_3456_7890)
57+
const n = numerals(12_3456_7890)
5858
expect(n.toTuples()).toEqual([[12, '億'], [3456, '万'], [7890, '']])
5959

6060
expect(n.toNumerals()).toEqual([
@@ -89,17 +89,17 @@ describe('jpNumerals', () => {
8989
})
9090

9191
it('can handle float', () => {
92-
const n = jpNumerals(12_3456_7890.123)
92+
const n = numerals(12_3456_7890.123)
9393
expect(n.toTuples()).toEqual([[12, '億'], [3456, '万'], [7890.123, '']])
9494
})
9595

9696
it('throw error if number is negative', () => {
97-
expect(() => jpNumerals(-12_3456_7890.123)).toThrow()
97+
expect(() => numerals(-12_3456_7890.123)).toThrow()
9898
})
9999

100100
it('can use base as option', () => {
101-
const n_base = jpNumerals(12_3456, JpNumeralUnit.)
102-
const n = jpNumerals(12_3456_0000)
101+
const n_base = numerals(12_3456, JpNumeralUnit.)
102+
const n = numerals(12_3456_0000)
103103

104104
expect(n_base.toTuples()).toEqual(n.toTuples())
105105
expect(n_base.toNumerals()).toEqual(n.toNumerals())

src/jp-numerals.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class NumeralZero extends Numeral {
5555
}
5656
}
5757

58-
export const jpNumerals = (n: number, base: JpNumeralUnit = JpNumeralUnit.): Numerals => {
58+
export const numerals = (n: number, base: JpNumeralUnit = JpNumeralUnit.): Numerals => {
5959
// TODO(handle negative)
6060
if (n < 0) {
6161
throw Error('number must be string')
@@ -81,4 +81,4 @@ export const jpNumerals = (n: number, base: JpNumeralUnit = JpNumeralUnit.零):
8181
}
8282
}
8383

84-
export default jpNumerals
84+
export default numerals

0 commit comments

Comments
 (0)