Skip to content

Commit 58b99d6

Browse files
authored
Merge pull request #3 from satotake/prepare-release
Prepare release
2 parents ba0c5d3 + b95dc45 commit 58b99d6

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

.travis.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ notifications:
66
email: false
77
node_js:
88
- '10'
9-
- '11'
10-
- '8'
11-
- '6'
129
script:
1310
- npm run test:prod && npm run build
1411
after_success:

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# jp-numerals
2+
Convert numbers into Japanese rank format
3+
(e.g. 123455 => 12_万_3455)
24

5+
inspired from [number-to-chinise-words](https://github.com/digi3studio/number-to-chinese-words)
6+
7+
## install
8+
9+
```shell
10+
npm install jp-numerals
11+
```
312

413
### Usage
514

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jp-numerals",
3-
"version": "0.0.0",
3+
"version": "0.0.0-development",
44
"description": "",
55
"keywords": [],
66
"main": "dist/jp-numerals.umd.js",
@@ -12,7 +12,7 @@
1212
"author": "SatowTakeshi <doublequotation@gmail.com>",
1313
"repository": {
1414
"type": "git",
15-
"url": ""
15+
"url": "https://github.com/satotake/jp-numerals"
1616
},
1717
"license": "MIT",
1818
"engines": {
@@ -106,7 +106,7 @@
106106
"rollup-plugin-node-resolve": "^3.4.0",
107107
"rollup-plugin-sourcemaps": "^0.4.2",
108108
"rollup-plugin-typescript2": "^0.18.0",
109-
"semantic-release": "^15.9.16",
109+
"semantic-release": "^15.13.16",
110110
"shelljs": "^0.8.3",
111111
"travis-deploy-once": "^5.0.9",
112112
"ts-jest": "^23.10.2",

src/jp-numerals.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ export class Numeral {
2424
return Math.floor(this.raw / Math.pow(10, this.rank * 4)) % Math.pow(10, 4)
2525
}
2626

27+
toTuple(): [number, string] {
28+
const { character, digits } = this
29+
return [digits, character]
30+
}
2731
toString(): string {
2832
return `${this.digits}${this.character}`
2933
}
@@ -70,7 +74,7 @@ export const jpNumerals = (n: number, base: JpNumeralUnit = JpNumeralUnit.零):
7074

7175
return {
7276
toArray: () => numerals,
73-
toTuples: () => numerals.map(numeral => [numeral.digits, numeral.character]),
77+
toTuples: () => numerals.map(numeral => numeral.toTuple()),
7478
toNumeralObjs: () => numerals.map(numeral => numeral.toNumeralObj()),
7579
toString: () => numerals.reduce((s, numeral) => `${s}${numeral}`, ''),
7680
toNumber: () => raw

0 commit comments

Comments
 (0)