-
-
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
1 parent
24e5dd9
commit 7c68deb
Showing
14 changed files
with
414 additions
and
1 deletion.
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,92 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- run: npm install | ||
- run: npm run build | ||
- run: npm run type-check | ||
- run: npm run coverage | ||
- name: Create idoc config. | ||
run: | | ||
cat > idoc.yml << EOF | ||
site: "Chinese Numerals {{version}}" | ||
menus: | ||
Home: index.html | ||
EOF | ||
- run: npm install idoc@1.26.6 -g | ||
- run: idoc | ||
|
||
- name: Create Coverage Badges | ||
uses: jaywcjlove/coverage-badges-cli@main | ||
with: | ||
source: coverage/coverage-summary.json | ||
output: dist/badges.svg | ||
|
||
- name: Generate Contributors Images | ||
uses: jaywcjlove/github-action-contributors@main | ||
with: | ||
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\]) | ||
output: dist/CONTRIBUTORS.svg | ||
avatarSize: 42 | ||
|
||
- name: Create Tag | ||
id: create_tag | ||
uses: jaywcjlove/create-tag-action@main | ||
with: | ||
package-path: ./package.json | ||
|
||
- name: get tag version | ||
id: tag_version | ||
uses: jaywcjlove/changelog-generator@main | ||
|
||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
commit_message: ${{steps.tag_version.outputs.tag}} ${{ github.event.head_commit.message }} | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./dist | ||
|
||
- name: Generate Changelog | ||
id: changelog | ||
uses: jaywcjlove/changelog-generator@main | ||
with: | ||
head-ref: ${{steps.create_tag.outputs.version}} | ||
filter-author: (renovate-bot|Renovate Bot) | ||
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}' | ||
|
||
- name: Create Release | ||
uses: ncipollo/release-action@v1 | ||
if: steps.create_tag.outputs.successful | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
name: ${{ steps.create_tag.outputs.version }} | ||
tag: ${{ steps.create_tag.outputs.version }} | ||
body: | | ||
[![](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@wcj/chinese-numerals@${{steps.changelog.outputs.version}}/file/README.md) | ||
Documentation ${{ steps.changelog.outputs.tag }}: https://raw.githack.com/jaywcjlove/chinese-numerals/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html | ||
Comparing Changes: ${{ steps.changelog.outputs.compareurl }} | ||
```shell | ||
npm i @wcj/chinese-numerals@${{steps.create_tag.outputs.versionNumber}} | ||
``` | ||
${{ steps.changelog.outputs.changelog }} | ||
- run: npm publish --access public | ||
name: 📦 @wcj/chinese-numerals publish to NPM | ||
continue-on-error: true | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,18 @@ | ||
lib | ||
node_modules | ||
coverage | ||
npm-debug.log* | ||
package-lock.json | ||
|
||
.eslintcache | ||
.DS_Store | ||
.cache | ||
.rdoc-dist | ||
|
||
*.log | ||
*.bak | ||
*.tem | ||
*.temp | ||
#.swp | ||
*.*~ | ||
~*.* |
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,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no-install lint-staged |
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,9 @@ | ||
**/*.md | ||
package.json | ||
package-lock.json | ||
node_modules | ||
dist | ||
build | ||
coverage | ||
lib | ||
test |
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,11 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"printWidth": 120, | ||
"overrides": [ | ||
{ | ||
"files": ".prettierrc", | ||
"options": { "parser": "json" } | ||
} | ||
] | ||
} |
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,2 +1,71 @@ | ||
# chinese-numerals | ||
Chinese Numerals | ||
=== | ||
|
||
Lowercase Chinese numerals | ||
|
||
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 100 | 1000 | 10000 | 10<sup>8</sup> | 10<sup>12</sup> | 10<sup>16</sup> | 10<sup>20</sup> | 10<sup>24</sup> | 10<sup>28</sup> | 10<sup>32</sup> | 10<sup>36</sup> | 10<sup>40</sup> | 10<sup>44</sup> | 10<sup>48</sup> | | ||
| - | - | - | - | - | - | - | - | - | - | -- | --- | ---- | ----- | --- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | | ||
| 〇 | 一 | 二 | 三 | 四 | 五 | 六 | 七 | 八 | 九 | 十 | 百 | 千 | 萬 | 億 | 兆 | 京 | 垓 | 秭 | 穰 | 溝 | 澗 | 正 | 載 | 極 | | ||
|
||
|
||
Uppercase Chinese numerals | ||
|
||
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 100 | 1000 | 10000 | 10<sup>8</sup> | 10<sup>12</sup> | 10<sup>16</sup> | 10<sup>20</sup> | 10<sup>24</sup> | 10<sup>28</sup> | 10<sup>32</sup> | 10<sup>36</sup> | 10<sup>40</sup> | 10<sup>44</sup> | 10<sup>48</sup> | | ||
| - | - | - | - | - | - | - | - | - | - | -- | --- | ---- | ----- | --- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | | ||
| 零 | 壹 | 貳 | 參 | 肆 | 伍 | 陸 | 柒 | 捌 | 玖 | 拾 | 佰 | 仟 | 萬 | 億 | 兆 | 京 | 垓 | 秭 | 穰 | 溝 | 澗 | 正 | 載 | 極 | | ||
|
||
Heavenly Dry(天干地支) | ||
|
||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | | ||
| - | - | - | - | - | - | - | - | - | - | | ||
|甲 | 乙 | 丙 | 丁 | 戊 | 己 | 庚 | 辛 | 壬 | 癸 | | ||
|
||
|
||
## Installation | ||
|
||
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): Node 12+ is needed to use it and it must be import instead of require. | ||
|
||
```bash | ||
npm install @wcj/chinese-numerals | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
import { lowercase, uppercase, heavenlyDry } from "@wcj/chinese-numerals"; | ||
|
||
console.log(lowercase) // => ['〇', '一', '二', '三', '四', ... ] | ||
console.log(lowercase[3]) // => '三' | ||
|
||
console.log(uppercase) // => ['零', '壹', '貳', '參', '肆', ... ] | ||
console.log(uppercase[2]) // => '貳' | ||
|
||
console.log(heavenlyDry) // => ['甲', '乙', '丙', '丁', '戊', '己', ... ] | ||
console.log(heavenlyDry[2 - 1]) // => '乙' | ||
``` | ||
|
||
```js | ||
import lowercase from "@wcj/chinese-numerals/lowercase.json"; | ||
import uppercase from "@wcj/chinese-numerals/uppercase.json"; | ||
import heavenlyDry from "@wcj/chinese-numerals/heavenly-dry.json"; | ||
|
||
console.log(lowercase) // => ['〇', '一', '二', '三', '四', ... ] | ||
console.log(lowercase[3]) // => '三' | ||
console.log(uppercase) // => ['零', '壹', '貳', '參', '肆', ... ] | ||
console.log(uppercase[2]) // => '貳' | ||
console.log(heavenlyDry[2 - 1]) // => '乙' | ||
``` | ||
|
||
## Contributors | ||
|
||
As always, thanks to our amazing contributors! | ||
|
||
<a href="https://github.com/jaywcjlove/chinese-numerals/graphs/contributors"> | ||
<img src="https://jaywcjlove.github.io/chinese-numerals/CONTRIBUTORS.svg" /> | ||
</a> | ||
|
||
Made with [contributors](https://github.com/jaywcjlove/github-action-contributors). | ||
|
||
## License | ||
|
||
Licensed under the MIT License. |
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 @@ | ||
["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"] |
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,27 @@ | ||
[ | ||
"〇", | ||
"一", | ||
"二", | ||
"三", | ||
"四", | ||
"五", | ||
"六", | ||
"七", | ||
"八", | ||
"九", | ||
"十", | ||
"百", | ||
"千", | ||
"萬", | ||
"億", | ||
"兆", | ||
"京", | ||
"垓", | ||
"秭", | ||
"穰", | ||
"溝", | ||
"澗", | ||
"正", | ||
"載", | ||
"極" | ||
] |
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,57 @@ | ||
{ | ||
"name": "@wcj/chinese-numerals", | ||
"version": "0.0.1", | ||
"description": "Chinese Numerals.", | ||
"type": "module", | ||
"types": "./lib/index.d.ts", | ||
"exports": "./lib/index.js", | ||
"homepage": "https://jaywcjlove.github.io/chinese-numerals/", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/jaywcjlove/chinese-numerals" | ||
}, | ||
"scripts": { | ||
"prepack": "husky install && npm run build", | ||
"start": "tsbb watch", | ||
"build": "tsbb build", | ||
"type-check": "tsc --noEmit", | ||
"test": "tsbb test", | ||
"coverage": "tsbb test --coverage", | ||
"prettier": "prettier --write \"**/*.{js,ts,json}\"" | ||
}, | ||
"keywords": [ | ||
"numerals", | ||
"Chinese", | ||
"chinese-numerals", | ||
"中文", | ||
"汉字", | ||
"数字大写", | ||
"数字小写", | ||
"中文数字", | ||
"数字" | ||
], | ||
"author": "Kenny Wang<wowohoo@qq.com>", | ||
"license": "MIT", | ||
"files": [ | ||
"src/index.ts", | ||
"lib" | ||
], | ||
"engines": { | ||
"node": ">=14.16" | ||
}, | ||
"jest": { | ||
"testPathIgnorePatterns": [ | ||
"<rootDir>/node_modules/", | ||
"<rootDir>/lib/" | ||
] | ||
}, | ||
"lint-staged": { | ||
"*.{js,ts,json}": "prettier --write" | ||
}, | ||
"devDependencies": { | ||
"husky": "^8.0.3", | ||
"lint-staged": "^13.2.0", | ||
"prettier": "^3.0.0", | ||
"tsbb": "^4.1.14" | ||
} | ||
} |
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,10 @@ | ||
{ | ||
"$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
"extends": ["config:base"], | ||
"packageRules": [ | ||
{ | ||
"matchPackagePatterns": ["*"], | ||
"rangeStrategy": "replace" | ||
} | ||
] | ||
} |
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,10 @@ | ||
import { lowercase, uppercase, heavenlyDry } from '../'; | ||
import upper from '../'; | ||
|
||
it('=> lowercase.length', () => expect(lowercase.length).toBe(25)); | ||
it('=> uppercase.length', () => expect(uppercase.length).toBe(25)); | ||
it('=> upper.length', () => expect(upper.length).toBe(25)); | ||
it('=> lowercase[3]', () => expect(lowercase[3]).toBe('三')); | ||
it('=> uppercase[2]', () => expect(uppercase[2]).toBe('貳')); | ||
it('=> heavenlyDry[2]', () => expect(heavenlyDry[2 - 1]).toBe('乙')); | ||
it('=> heavenlyDry.length', () => expect(heavenlyDry.length).toBe(10)); |
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,56 @@ | ||
export const lowercase = [ | ||
'〇', | ||
'一', | ||
'二', | ||
'三', | ||
'四', | ||
'五', | ||
'六', | ||
'七', | ||
'八', | ||
'九', | ||
'十', | ||
'百', | ||
'千', | ||
'萬', | ||
'億', | ||
'兆', | ||
'京', | ||
'垓', | ||
'秭', | ||
'穰', | ||
'溝', | ||
'澗', | ||
'正', | ||
'載', | ||
'極', | ||
] as const; | ||
export const uppercase = [ | ||
'零', | ||
'壹', | ||
'貳', | ||
'參', | ||
'肆', | ||
'伍', | ||
'陸', | ||
'柒', | ||
'捌', | ||
'玖', | ||
'拾', | ||
'佰', | ||
'仟', | ||
'萬', | ||
'億', | ||
'兆', | ||
'京', | ||
'垓', | ||
'秭', | ||
'穰', | ||
'溝', | ||
'澗', | ||
'正', | ||
'載', | ||
'極', | ||
] as const; | ||
export const heavenlyDry = ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸']; | ||
export default uppercase; |
Oops, something went wrong.