From 14c804149e652ec339f821d560aba572b449f412 Mon Sep 17 00:00:00 2001 From: fisker Cheung Date: Fri, 26 Nov 2021 23:14:59 +0800 Subject: [PATCH] Init --- .editorconfig | 42 +++ .eslintignore | 27 ++ .eslintrc.cjs | 20 ++ .gitattributes | 1 + .github/workflows/continuous-integration.yml | 107 +++++++ .gitignore | 96 ++++++ .husky/pre-commit | 4 + .markdownlint.json | 4 + .npmrc | 2 + .prettierignore | 30 ++ .yarnrc | 1 + currencies-raw.js | 4 + currencies.js | 295 +++++++++++++++++++ index.js | 20 ++ license | 21 ++ lint-staged.config.cjs | 9 + package.json | 77 +++++ prettier.config.cjs | 8 + readme.md | 38 +++ renovate.json | 6 + scripts/generate.js | 40 +++ scripts/get-data.js | 66 +++++ test.js | 33 +++ 23 files changed, 951 insertions(+) create mode 100644 .editorconfig create mode 100644 .eslintignore create mode 100644 .eslintrc.cjs create mode 100644 .gitattributes create mode 100644 .github/workflows/continuous-integration.yml create mode 100644 .gitignore create mode 100644 .husky/pre-commit create mode 100644 .markdownlint.json create mode 100644 .npmrc create mode 100644 .prettierignore create mode 100644 .yarnrc create mode 100644 currencies-raw.js create mode 100644 currencies.js create mode 100644 index.js create mode 100644 license create mode 100644 lint-staged.config.cjs create mode 100644 package.json create mode 100644 prettier.config.cjs create mode 100644 readme.md create mode 100644 renovate.json create mode 100644 scripts/generate.js create mode 100644 scripts/get-data.js create mode 100644 test.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..51827ea --- /dev/null +++ b/.editorconfig @@ -0,0 +1,42 @@ +# config file for `editorconfig` +# +# update: wget -O .editorconfig https://git.io/fjVjz +# document: https://editorconfig.org +# + +# top-most EditorConfig file +root = true + +# all files +[*] + +# Set default charset +charset = utf-8 + +# Unix-style newlines +end_of_line = lf + +# with a newline ending every file +insert_final_newline = true + +# 2 space indentation +indent_style = space +indent_size = 2 + +# remove any whitespace characters preceding newline characters +trim_trailing_whitespace = true + +# overrides + +# python overrides +[*.py] +indent_size = 4 + +# cmd overrides +[*.{bat,cmd}] +charset = ansi +end_of_line = crlf + +# markdown +[*.{md,markdown}] +insert_final_newline = false diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..5f9ef28 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,27 @@ +# ignore file for `eslint` +# +# update: wget -O .eslintignore https://git.io/fjVjo +# document: https://eslint.org/docs/user-guide/configuring#eslintignore +# + +# also lint dot files +!.* + +# vendors +node_modules/** +**/vendors/** +**/vendor/** +**/third-party/** + +# build file +dist/** +**/*.min.* + +# fixtures +**/fixtures/** + +# test +.nyc_output/** +coverage/** + +# project glob diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..ddd602d --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,20 @@ +/*! + * config file for `eslint` + * + * update: wget -O .eslintrc.js https://git.io/fjVjK + * document: https://eslint.org/docs/user-guide/configuring + */ + +/* @fisker/eslint-config https://git.io/fjOeH */ + +module.exports = { + root: true, + env: {}, + parserOptions: {}, + extends: ['@fisker'], + settings: {}, + rules: {}, + plugins: [], + globals: {}, + overrides: [{files: ['test.js'], extends: ['@fisker/ava']}], +} diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..a992a3e --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,107 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + # schedule: + # - cron: "0 23 * * 6" + +jobs: + test: + strategy: + fail-fast: false + matrix: + os: + - "ubuntu-latest" + - "macos-latest" + - "windows-latest" + node_version: + - "16" + - "14" + - "12" + # exclude: + # - os: "macos-latest" + # node_version: "12" + + name: Node.js ${{ matrix.node_version }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + # needs: [build] + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node_version }} + + - name: Install Dependencies + run: yarn + + # - name: Download Artifact + # uses: actions/download-artifact@v2 + # with: + # name: dist + # path: dist + + - name: Run Test + run: yarn test-coverage + + - name: Upload Coverage + uses: coverallsapp/github-action@master + if: success() + continue-on-error: true + with: + github-token: ${{ secrets.github_token }} + parallel: true + + coverage: + needs: test + runs-on: ubuntu-latest + steps: + - name: Sending webhook to Coveralls + uses: coverallsapp/github-action@master + continue-on-error: true + with: + github-token: ${{ secrets.github_token }} + parallel-finished: true + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + + - name: Install Dependencies + run: yarn + + - name: Run Lint + run: yarn lint + + # build: + # name: Build + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v2 + + # - name: Setup Node.js + # uses: actions/setup-node@v2 + + # - name: Install Dependencies + # run: yarn + + # - name: Build Package + # run: yarn build + + # - name: Upload Artifact + # uses: actions/upload-artifact@v2 + # with: + # name: dist + # path: dist diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d05b6af --- /dev/null +++ b/.gitignore @@ -0,0 +1,96 @@ +# ignore file for git project +# +# update: wget -O .gitignore https://git.io/fjXI5 +# + +# Base on https://www.gitignore.io/api/node + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +yarn.lock + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# project ignore files +dist/ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 0000000..36af219 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +npx lint-staged diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..984d373 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,4 @@ +{ + "default": true, + "line-length": false +} diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..1872a03 --- /dev/null +++ b/.npmrc @@ -0,0 +1,2 @@ +save-prefix="" +package-lock=false diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..ee5360f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,30 @@ +# ignore file for `prettier` +# +# update: wget -O .prettierignore https://git.io/fjVj5 +# document: https://prettier.io/docs/en/ignore.html#ignoring-files +# + +# also prettier dot files +!.* + +# vendors +node_modules/** +**/vendors/** +**/vendor/** +**/third-party/** + +# build file +dist/** +**/*.min.* + +# fixtures +**/fixtures/** + +# test +.nyc_output/** +coverage/** + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# project glob diff --git a/.yarnrc b/.yarnrc new file mode 100644 index 0000000..fdd705c --- /dev/null +++ b/.yarnrc @@ -0,0 +1 @@ +save-prefix "" diff --git a/currencies-raw.js b/currencies-raw.js new file mode 100644 index 0000000..3dab9ad --- /dev/null +++ b/currencies-raw.js @@ -0,0 +1,4 @@ +export default [ + 'AED阿联酋迪拉姆,AFN阿富汗尼,ALL阿尔巴尼亚列克,AMD亚美尼亚德拉姆,ANG荷属安的列斯盾,AOA安哥拉宽扎,ARS阿根廷比索,AUD澳大利亚元,AWG阿鲁巴弗罗林,AZN阿塞拜疆马纳特,BAM波斯尼亚和黑塞哥维那可兑换马克,BBD巴巴多斯元,BDT孟加拉塔卡,BGN保加利亚列弗,BHD巴林第纳尔,BIF布隆迪法郎,BMD百慕大元,BND文莱元,BOB玻利维亚诺,BOVMvdol(资金代码),BRL巴西雷亚尔,BSD巴哈马元,BTN不丹努尔特鲁姆,BWP博茨瓦纳普拉,BYN白俄罗斯卢布,BZD伯利兹元,CAD加拿大元,CDF刚果法郎,CHEWIR(英语:WIR Bank)欧元(补充货币),CHF瑞士法郎,CHWWIR(英语:WIR Bank)法郎(补充货币),CLF发展单位(资金代码),CLP智利比索,CNY人民币元,COP哥伦比亚比索,COU哥伦比亚实际单位(UVR,资金代码),CRC哥斯达黎加科朗,CUC古巴可兑换比索,CUP古巴比索,CVE佛得角埃斯库多,CZK捷克克朗,DJF吉布提法郎,DKK丹麦克朗,DOP多米尼加比索,DZD阿尔及利亚第纳尔,EGP埃及镑,ERN厄立特里亚纳克法,ETB埃塞俄比亚比尔,EUR欧元,FJD斐济元,FKP福克兰群岛镑,GBP英镑,GEL格鲁吉亚拉里,GHS加纳塞地,GIP直布罗陀镑,GMD冈比亚达拉西,GNF几内亚法郎,GTQ危地马拉格查尔,GYD圭亚那元,HKD港元,HNL洪都拉斯伦皮拉,HRK克罗地亚库纳,HTG海地古德,HUF匈牙利福林,IDR印尼盾,ILS以色列新谢克尔,INR印度卢比,IQD伊拉克第纳尔,IRR伊朗里亚尔,ISK冰岛克朗,JMD牙买加元,JOD约旦第纳尔,JPY日圆,KES肯尼亚先令,KGS吉尔吉斯斯坦索姆,KHR柬埔寨瑞尔,KMF科摩罗法郎,KPW朝鲜圆,KRW韩圆,KWD科威特第纳尔,KYD开曼群岛元,KZT哈萨克斯坦坚戈,LAK老挝基普,LBP黎巴嫩镑,LKR斯里兰卡卢比,LRD利比里亚元,LSL莱索托洛蒂,LYD利比亚第纳尔,MAD摩洛哥迪尔汗,MDL摩尔多瓦列伊,MGA马达加斯加阿里亚里,MKD马其顿代纳尔,MMK缅元,MNT蒙古图格里克,MOP澳门币,MRU毛里塔尼亚乌吉亚,MUR毛里求斯卢比,MVR马尔代夫拉菲亚,MWK马拉维克瓦查,MXN墨西哥比索,MXV墨西哥发展单位(UDI,资金代码),MYR马来西亚令吉,MZN莫桑比克梅蒂卡尔,NAD纳米比亚元,NGN尼日利亚奈拉,NIO尼加拉瓜科多巴,NOK挪威克朗,NPR尼泊尔卢比,NZD新西兰元,OMR阿曼里亚尔,PAB巴拿马巴波亚,PEN秘鲁索尔,PGK巴布亚新几内亚基那,PHP菲律宾披索,PKR巴基斯坦卢比,PLN波兰兹罗提,PYG巴拉圭瓜拉尼,QAR卡塔尔里亚尔,RON罗马尼亚列伊,RSD塞尔维亚第纳尔,RUB俄罗斯卢布,RWF卢旺达法郎,SAR沙特里亚尔,SBD所罗门群岛元,SCR塞舌尔卢比,SDG苏丹镑,SEK瑞典克朗,SGD新加坡元,SHP圣赫勒拿镑,SLL塞拉利昂利昂,SOS索马里先令,SRD苏里南元,SSP南苏丹镑,STN圣多美和普林西比多布拉,SYP叙利亚镑,SZL斯威士兰里兰吉尼,THB泰铢,TJS塔吉克斯坦索莫尼,TMT土库曼斯坦马纳特,TND突尼斯第纳尔,TOP汤加潘加,TRY土耳其里拉,TTD特立尼达和多巴哥元,TWD新台幣,TZS坦桑尼亚先令,UAH乌克兰格里夫纳,UGX乌干达先令,USD美元,USN美元(次日,资金代码),UYI乌拉圭比索资金索引(URUIURUI,资金代码),UYU乌拉圭比索,UZS乌兹别克斯坦索姆,VES委内瑞拉玻利瓦尔,VND越南盾,VUV瓦努阿图瓦图,WST萨摩亚塔拉,XAF中非法郎,XAG银(1金衡盎司),XAU金(1金衡盎司),XBA欧洲货币合成单(EURCO,债券市场单位),XBB欧洲货币单位(E.M.U.-6,债券市场单位),XBC欧洲账户9单位(E.U.A.-9,债券市场单位),XBD欧洲账户17单位(E.U.A.-17,债券市场单位),XCD东加勒比元,XDR特别提款权,XFUUIC法郎(特别结算货币),XOF西非法郎,XPD钯(1金衡盎司),XPF太平洋法郎(franc Pacifique),XPT铂(1金衡盎司),XSU苏克雷(英语:SUCRE),XTS为测试而特别保留的代码,XUA非洲开发银行记帐单位,XXX未包括的交易货币代码,YER也门里亚尔,ZAR南非兰特,ZMW赞比亚克瓦查', + 'ADF安道尔法郎(与法国法郎1:1挂钩),ADP安道尔比塞塔(与西班牙比塞塔1:1挂钩),ATS奥地利先令,BAD波斯尼亚和黑塞哥维那第纳尔,BEF比利时法郎(与LUF为货币联盟),BYB白俄罗斯卢布A/99,BYR白俄罗斯卢布A/16,CYP塞浦路斯镑,DEM德国马克,EEK爱沙尼亚克朗,ESP西班牙比塞塔,FIM芬兰马克,FRF法国法郎,GRD希腊德拉克马,IEP爱尔兰镑,ITL意大利里拉,LTL立陶宛立特,LUF卢森堡法郎(与BEF为货币联盟),LVL拉脱维亚拉特,MCF摩纳哥法郎(与FRF为货币联盟),MAF摩洛哥法郎,MTL马耳他里拉,NLG荷兰盾,PTE葡萄牙埃斯库多,SIT斯洛文尼亚托拉尔,SKK斯洛伐克克朗,SML圣马利诺里拉(与ITL和VAL为货币联盟),VAL梵蒂冈里拉(与ITL和SML为货币联盟),XEU欧洲货币单位(1 XEU = 1 EUR),AFA阿富汗尼,AOK安哥拉宽扎,AON安哥拉新宽扎,AOR安哥拉调整宽扎,ARL阿根廷比索莱伊,ARP比索阿根廷,ARA阿根廷奥斯特拉尔,AZM阿塞拜疆马纳特,BGL保加利亚列弗A/99,BOP玻利维亚比索,BRZ巴西克鲁塞罗,BRB巴西新克鲁塞罗,BRC巴西克鲁扎多,BRN巴西新克鲁扎多,BRE巴西克鲁塞罗,BRR巴西克鲁塞罗里亚尔,CLE智利埃斯库多,CSD塞尔维亚第纳尔,CSK捷克斯洛伐克克朗,DDM东德马克,ECS厄瓜多尔苏克雷,ECV厄瓜多尔常量单位(资金代码),GQE赤道几内亚埃奎勒,ESA西班牙比塞塔(A账户),ESB西班牙比塞塔(B账户),GNE几内亚西里,GHC加纳塞地,GWP几内亚比绍比索,HRD克罗地亚第纳尔,ILP以色列里拉,ILR旧锡克尔,ISJ冰岛克朗,LAJ老挝基普,MGF马达加斯加法郎,MKN旧马其顿代纳尔A/93,MLF马里法郎,MVQ马尔代夫卢比,MXP墨西哥比索,MZM莫桑比克梅蒂卡尔,NFD纽芬兰元,PEH秘鲁索尔,PEI秘鲁印地,PLZ波兰兹罗提A/94,PTP葡属帝汶元,TPE葡属帝汶埃斯库多,ROL罗马尼亚列伊A/05,RUR俄罗斯卢布A/97,SDP旧苏丹镑,SDD苏丹第纳尔,SRG苏里南盾,SUR苏联卢布,SVC萨尔瓦多科朗,TJR塔吉克斯坦卢布,TMM土库曼斯坦马纳特,TNF突尼斯法郎,TRL土耳其里拉A/05,UAK乌克兰库邦,UGS乌干达先令A/87,USS美元(同日,资金代码),UYN乌拉圭旧比索,VEB委内瑞拉玻利瓦尔A/08,VEF委内瑞拉玻利瓦尔A/18,XFO金法郎(特别结算货币),YDD南也门第纳尔,YUD南斯拉夫第纳尔,YUN南斯拉夫第纳尔,YUR南斯拉夫第纳尔,YUO南斯拉夫第纳尔,YUG南斯拉夫第纳尔,YUM南斯拉夫第纳尔,ZAL南非金融兰特(资金代码),ZMK赞比亚克瓦查,ZRN扎伊尔新扎伊尔,ZRZ扎伊尔扎伊尔,ZWC罗得西亚元,ZWD津巴布韦元A/06,ZWN津巴布韦元A/08,ZWR津巴布韦元A/09,ZWL津巴布韦元A/10', +] diff --git a/currencies.js b/currencies.js new file mode 100644 index 0000000..f34d40b --- /dev/null +++ b/currencies.js @@ -0,0 +1,295 @@ +/* + * DO NOT EDIT THIS FILE + * + * Auto generated by script `scripts/generate.js` + */ + +export const current = [ + {code: 'AED', name: '阿联酋迪拉姆'}, + {code: 'AFN', name: '阿富汗尼'}, + {code: 'ALL', name: '阿尔巴尼亚列克'}, + {code: 'AMD', name: '亚美尼亚德拉姆'}, + {code: 'ANG', name: '荷属安的列斯盾'}, + {code: 'AOA', name: '安哥拉宽扎'}, + {code: 'ARS', name: '阿根廷比索'}, + {code: 'AUD', name: '澳大利亚元'}, + {code: 'AWG', name: '阿鲁巴弗罗林'}, + {code: 'AZN', name: '阿塞拜疆马纳特'}, + {code: 'BAM', name: '波斯尼亚和黑塞哥维那可兑换马克'}, + {code: 'BBD', name: '巴巴多斯元'}, + {code: 'BDT', name: '孟加拉塔卡'}, + {code: 'BGN', name: '保加利亚列弗'}, + {code: 'BHD', name: '巴林第纳尔'}, + {code: 'BIF', name: '布隆迪法郎'}, + {code: 'BMD', name: '百慕大元'}, + {code: 'BND', name: '文莱元'}, + {code: 'BOB', name: '玻利维亚诺'}, + {code: 'BOV', name: 'Mvdol(资金代码)'}, + {code: 'BRL', name: '巴西雷亚尔'}, + {code: 'BSD', name: '巴哈马元'}, + {code: 'BTN', name: '不丹努尔特鲁姆'}, + {code: 'BWP', name: '博茨瓦纳普拉'}, + {code: 'BYN', name: '白俄罗斯卢布'}, + {code: 'BZD', name: '伯利兹元'}, + {code: 'CAD', name: '加拿大元'}, + {code: 'CDF', name: '刚果法郎'}, + {code: 'CHE', name: 'WIR(英语:WIR Bank)欧元(补充货币)'}, + {code: 'CHF', name: '瑞士法郎'}, + {code: 'CHW', name: 'WIR(英语:WIR Bank)法郎(补充货币)'}, + {code: 'CLF', name: '发展单位(资金代码)'}, + {code: 'CLP', name: '智利比索'}, + {code: 'CNY', name: '人民币元'}, + {code: 'COP', name: '哥伦比亚比索'}, + {code: 'COU', name: '哥伦比亚实际单位(UVR,资金代码)'}, + {code: 'CRC', name: '哥斯达黎加科朗'}, + {code: 'CUC', name: '古巴可兑换比索'}, + {code: 'CUP', name: '古巴比索'}, + {code: 'CVE', name: '佛得角埃斯库多'}, + {code: 'CZK', name: '捷克克朗'}, + {code: 'DJF', name: '吉布提法郎'}, + {code: 'DKK', name: '丹麦克朗'}, + {code: 'DOP', name: '多米尼加比索'}, + {code: 'DZD', name: '阿尔及利亚第纳尔'}, + {code: 'EGP', name: '埃及镑'}, + {code: 'ERN', name: '厄立特里亚纳克法'}, + {code: 'ETB', name: '埃塞俄比亚比尔'}, + {code: 'EUR', name: '欧元'}, + {code: 'FJD', name: '斐济元'}, + {code: 'FKP', name: '福克兰群岛镑'}, + {code: 'GBP', name: '英镑'}, + {code: 'GEL', name: '格鲁吉亚拉里'}, + {code: 'GHS', name: '加纳塞地'}, + {code: 'GIP', name: '直布罗陀镑'}, + {code: 'GMD', name: '冈比亚达拉西'}, + {code: 'GNF', name: '几内亚法郎'}, + {code: 'GTQ', name: '危地马拉格查尔'}, + {code: 'GYD', name: '圭亚那元'}, + {code: 'HKD', name: '港元'}, + {code: 'HNL', name: '洪都拉斯伦皮拉'}, + {code: 'HRK', name: '克罗地亚库纳'}, + {code: 'HTG', name: '海地古德'}, + {code: 'HUF', name: '匈牙利福林'}, + {code: 'IDR', name: '印尼盾'}, + {code: 'ILS', name: '以色列新谢克尔'}, + {code: 'INR', name: '印度卢比'}, + {code: 'IQD', name: '伊拉克第纳尔'}, + {code: 'IRR', name: '伊朗里亚尔'}, + {code: 'ISK', name: '冰岛克朗'}, + {code: 'JMD', name: '牙买加元'}, + {code: 'JOD', name: '约旦第纳尔'}, + {code: 'JPY', name: '日圆'}, + {code: 'KES', name: '肯尼亚先令'}, + {code: 'KGS', name: '吉尔吉斯斯坦索姆'}, + {code: 'KHR', name: '柬埔寨瑞尔'}, + {code: 'KMF', name: '科摩罗法郎'}, + {code: 'KPW', name: '朝鲜圆'}, + {code: 'KRW', name: '韩圆'}, + {code: 'KWD', name: '科威特第纳尔'}, + {code: 'KYD', name: '开曼群岛元'}, + {code: 'KZT', name: '哈萨克斯坦坚戈'}, + {code: 'LAK', name: '老挝基普'}, + {code: 'LBP', name: '黎巴嫩镑'}, + {code: 'LKR', name: '斯里兰卡卢比'}, + {code: 'LRD', name: '利比里亚元'}, + {code: 'LSL', name: '莱索托洛蒂'}, + {code: 'LYD', name: '利比亚第纳尔'}, + {code: 'MAD', name: '摩洛哥迪尔汗'}, + {code: 'MDL', name: '摩尔多瓦列伊'}, + {code: 'MGA', name: '马达加斯加阿里亚里'}, + {code: 'MKD', name: '马其顿代纳尔'}, + {code: 'MMK', name: '缅元'}, + {code: 'MNT', name: '蒙古图格里克'}, + {code: 'MOP', name: '澳门币'}, + {code: 'MRU', name: '毛里塔尼亚乌吉亚'}, + {code: 'MUR', name: '毛里求斯卢比'}, + {code: 'MVR', name: '马尔代夫拉菲亚'}, + {code: 'MWK', name: '马拉维克瓦查'}, + {code: 'MXN', name: '墨西哥比索'}, + {code: 'MXV', name: '墨西哥发展单位(UDI,资金代码)'}, + {code: 'MYR', name: '马来西亚令吉'}, + {code: 'MZN', name: '莫桑比克梅蒂卡尔'}, + {code: 'NAD', name: '纳米比亚元'}, + {code: 'NGN', name: '尼日利亚奈拉'}, + {code: 'NIO', name: '尼加拉瓜科多巴'}, + {code: 'NOK', name: '挪威克朗'}, + {code: 'NPR', name: '尼泊尔卢比'}, + {code: 'NZD', name: '新西兰元'}, + {code: 'OMR', name: '阿曼里亚尔'}, + {code: 'PAB', name: '巴拿马巴波亚'}, + {code: 'PEN', name: '秘鲁索尔'}, + {code: 'PGK', name: '巴布亚新几内亚基那'}, + {code: 'PHP', name: '菲律宾披索'}, + {code: 'PKR', name: '巴基斯坦卢比'}, + {code: 'PLN', name: '波兰兹罗提'}, + {code: 'PYG', name: '巴拉圭瓜拉尼'}, + {code: 'QAR', name: '卡塔尔里亚尔'}, + {code: 'RON', name: '罗马尼亚列伊'}, + {code: 'RSD', name: '塞尔维亚第纳尔'}, + {code: 'RUB', name: '俄罗斯卢布'}, + {code: 'RWF', name: '卢旺达法郎'}, + {code: 'SAR', name: '沙特里亚尔'}, + {code: 'SBD', name: '所罗门群岛元'}, + {code: 'SCR', name: '塞舌尔卢比'}, + {code: 'SDG', name: '苏丹镑'}, + {code: 'SEK', name: '瑞典克朗'}, + {code: 'SGD', name: '新加坡元'}, + {code: 'SHP', name: '圣赫勒拿镑'}, + {code: 'SLL', name: '塞拉利昂利昂'}, + {code: 'SOS', name: '索马里先令'}, + {code: 'SRD', name: '苏里南元'}, + {code: 'SSP', name: '南苏丹镑'}, + {code: 'STN', name: '圣多美和普林西比多布拉'}, + {code: 'SYP', name: '叙利亚镑'}, + {code: 'SZL', name: '斯威士兰里兰吉尼'}, + {code: 'THB', name: '泰铢'}, + {code: 'TJS', name: '塔吉克斯坦索莫尼'}, + {code: 'TMT', name: '土库曼斯坦马纳特'}, + {code: 'TND', name: '突尼斯第纳尔'}, + {code: 'TOP', name: '汤加潘加'}, + {code: 'TRY', name: '土耳其里拉'}, + {code: 'TTD', name: '特立尼达和多巴哥元'}, + {code: 'TWD', name: '新台幣'}, + {code: 'TZS', name: '坦桑尼亚先令'}, + {code: 'UAH', name: '乌克兰格里夫纳'}, + {code: 'UGX', name: '乌干达先令'}, + {code: 'USD', name: '美元'}, + {code: 'USN', name: '美元(次日,资金代码)'}, + {code: 'UYI', name: '乌拉圭比索资金索引(URUIURUI,资金代码)'}, + {code: 'UYU', name: '乌拉圭比索'}, + {code: 'UZS', name: '乌兹别克斯坦索姆'}, + {code: 'VES', name: '委内瑞拉玻利瓦尔'}, + {code: 'VND', name: '越南盾'}, + {code: 'VUV', name: '瓦努阿图瓦图'}, + {code: 'WST', name: '萨摩亚塔拉'}, + {code: 'XAF', name: '中非法郎'}, + {code: 'XAG', name: '银(1金衡盎司)'}, + {code: 'XAU', name: '金(1金衡盎司)'}, + {code: 'XBA', name: '欧洲货币合成单(EURCO,债券市场单位)'}, + {code: 'XBB', name: '欧洲货币单位(E.M.U.-6,债券市场单位)'}, + {code: 'XBC', name: '欧洲账户9单位(E.U.A.-9,债券市场单位)'}, + {code: 'XBD', name: '欧洲账户17单位(E.U.A.-17,债券市场单位)'}, + {code: 'XCD', name: '东加勒比元'}, + {code: 'XDR', name: '特别提款权'}, + {code: 'XFU', name: 'UIC法郎(特别结算货币)'}, + {code: 'XOF', name: '西非法郎'}, + {code: 'XPD', name: '钯(1金衡盎司)'}, + {code: 'XPF', name: '太平洋法郎(franc Pacifique)'}, + {code: 'XPT', name: '铂(1金衡盎司)'}, + {code: 'XSU', name: '苏克雷(英语:SUCRE)'}, + {code: 'XTS', name: '为测试而特别保留的代码'}, + {code: 'XUA', name: '非洲开发银行记帐单位'}, + {code: 'XXX', name: '未包括的交易货币代码'}, + {code: 'YER', name: '也门里亚尔'}, + {code: 'ZAR', name: '南非兰特'}, + {code: 'ZMW', name: '赞比亚克瓦查'}, +] +export const outdated = [ + {code: 'ADF', name: '安道尔法郎(与法国法郎1:1挂钩)'}, + {code: 'ADP', name: '安道尔比塞塔(与西班牙比塞塔1:1挂钩)'}, + {code: 'ATS', name: '奥地利先令'}, + {code: 'BAD', name: '波斯尼亚和黑塞哥维那第纳尔'}, + {code: 'BEF', name: '比利时法郎(与LUF为货币联盟)'}, + {code: 'BYB', name: '白俄罗斯卢布A/99'}, + {code: 'BYR', name: '白俄罗斯卢布A/16'}, + {code: 'CYP', name: '塞浦路斯镑'}, + {code: 'DEM', name: '德国马克'}, + {code: 'EEK', name: '爱沙尼亚克朗'}, + {code: 'ESP', name: '西班牙比塞塔'}, + {code: 'FIM', name: '芬兰马克'}, + {code: 'FRF', name: '法国法郎'}, + {code: 'GRD', name: '希腊德拉克马'}, + {code: 'IEP', name: '爱尔兰镑'}, + {code: 'ITL', name: '意大利里拉'}, + {code: 'LTL', name: '立陶宛立特'}, + {code: 'LUF', name: '卢森堡法郎(与BEF为货币联盟)'}, + {code: 'LVL', name: '拉脱维亚拉特'}, + {code: 'MCF', name: '摩纳哥法郎(与FRF为货币联盟)'}, + {code: 'MAF', name: '摩洛哥法郎'}, + {code: 'MTL', name: '马耳他里拉'}, + {code: 'NLG', name: '荷兰盾'}, + {code: 'PTE', name: '葡萄牙埃斯库多'}, + {code: 'SIT', name: '斯洛文尼亚托拉尔'}, + {code: 'SKK', name: '斯洛伐克克朗'}, + {code: 'SML', name: '圣马利诺里拉(与ITL和VAL为货币联盟)'}, + {code: 'VAL', name: '梵蒂冈里拉(与ITL和SML为货币联盟)'}, + {code: 'XEU', name: '欧洲货币单位(1 XEU = 1 EUR)'}, + {code: 'AFA', name: '阿富汗尼'}, + {code: 'AOK', name: '安哥拉宽扎'}, + {code: 'AON', name: '安哥拉新宽扎'}, + {code: 'AOR', name: '安哥拉调整宽扎'}, + {code: 'ARL', name: '阿根廷比索莱伊'}, + {code: 'ARP', name: '比索阿根廷'}, + {code: 'ARA', name: '阿根廷奥斯特拉尔'}, + {code: 'AZM', name: '阿塞拜疆马纳特'}, + {code: 'BGL', name: '保加利亚列弗A/99'}, + {code: 'BOP', name: '玻利维亚比索'}, + {code: 'BRZ', name: '巴西克鲁塞罗'}, + {code: 'BRB', name: '巴西新克鲁塞罗'}, + {code: 'BRC', name: '巴西克鲁扎多'}, + {code: 'BRN', name: '巴西新克鲁扎多'}, + {code: 'BRE', name: '巴西克鲁塞罗'}, + {code: 'BRR', name: '巴西克鲁塞罗里亚尔'}, + {code: 'CLE', name: '智利埃斯库多'}, + {code: 'CSD', name: '塞尔维亚第纳尔'}, + {code: 'CSK', name: '捷克斯洛伐克克朗'}, + {code: 'DDM', name: '东德马克'}, + {code: 'ECS', name: '厄瓜多尔苏克雷'}, + {code: 'ECV', name: '厄瓜多尔常量单位(资金代码)'}, + {code: 'GQE', name: '赤道几内亚埃奎勒'}, + {code: 'ESA', name: '西班牙比塞塔(A账户)'}, + {code: 'ESB', name: '西班牙比塞塔(B账户)'}, + {code: 'GNE', name: '几内亚西里'}, + {code: 'GHC', name: '加纳塞地'}, + {code: 'GWP', name: '几内亚比绍比索'}, + {code: 'HRD', name: '克罗地亚第纳尔'}, + {code: 'ILP', name: '以色列里拉'}, + {code: 'ILR', name: '旧锡克尔'}, + {code: 'ISJ', name: '冰岛克朗'}, + {code: 'LAJ', name: '老挝基普'}, + {code: 'MGF', name: '马达加斯加法郎'}, + {code: 'MKN', name: '旧马其顿代纳尔A/93'}, + {code: 'MLF', name: '马里法郎'}, + {code: 'MVQ', name: '马尔代夫卢比'}, + {code: 'MXP', name: '墨西哥比索'}, + {code: 'MZM', name: '莫桑比克梅蒂卡尔'}, + {code: 'NFD', name: '纽芬兰元'}, + {code: 'PEH', name: '秘鲁索尔'}, + {code: 'PEI', name: '秘鲁印地'}, + {code: 'PLZ', name: '波兰兹罗提A/94'}, + {code: 'PTP', name: '葡属帝汶元'}, + {code: 'TPE', name: '葡属帝汶埃斯库多'}, + {code: 'ROL', name: '罗马尼亚列伊A/05'}, + {code: 'RUR', name: '俄罗斯卢布A/97'}, + {code: 'SDP', name: '旧苏丹镑'}, + {code: 'SDD', name: '苏丹第纳尔'}, + {code: 'SRG', name: '苏里南盾'}, + {code: 'SUR', name: '苏联卢布'}, + {code: 'SVC', name: '萨尔瓦多科朗'}, + {code: 'TJR', name: '塔吉克斯坦卢布'}, + {code: 'TMM', name: '土库曼斯坦马纳特'}, + {code: 'TNF', name: '突尼斯法郎'}, + {code: 'TRL', name: '土耳其里拉A/05'}, + {code: 'UAK', name: '乌克兰库邦'}, + {code: 'UGS', name: '乌干达先令A/87'}, + {code: 'USS', name: '美元(同日,资金代码)'}, + {code: 'UYN', name: '乌拉圭旧比索'}, + {code: 'VEB', name: '委内瑞拉玻利瓦尔A/08'}, + {code: 'VEF', name: '委内瑞拉玻利瓦尔A/18'}, + {code: 'XFO', name: '金法郎(特别结算货币)'}, + {code: 'YDD', name: '南也门第纳尔'}, + {code: 'YUD', name: '南斯拉夫第纳尔'}, + {code: 'YUN', name: '南斯拉夫第纳尔'}, + {code: 'YUR', name: '南斯拉夫第纳尔'}, + {code: 'YUO', name: '南斯拉夫第纳尔'}, + {code: 'YUG', name: '南斯拉夫第纳尔'}, + {code: 'YUM', name: '南斯拉夫第纳尔'}, + {code: 'ZAL', name: '南非金融兰特(资金代码)'}, + {code: 'ZMK', name: '赞比亚克瓦查'}, + {code: 'ZRN', name: '扎伊尔新扎伊尔'}, + {code: 'ZRZ', name: '扎伊尔扎伊尔'}, + {code: 'ZWC', name: '罗得西亚元'}, + {code: 'ZWD', name: '津巴布韦元A/06'}, + {code: 'ZWN', name: '津巴布韦元A/08'}, + {code: 'ZWR', name: '津巴布韦元A/09'}, + {code: 'ZWL', name: '津巴布韦元A/10'}, +] diff --git a/index.js b/index.js new file mode 100644 index 0000000..330b305 --- /dev/null +++ b/index.js @@ -0,0 +1,20 @@ +import rawData from './currencies-raw.js' + +function parseRawData(text) { + return Object.fromEntries( + text.split(',').map((string) => [string.slice(0, 3), string.slice(3)]), + ) +} + +const currencies = new Map() +function getCurrencyName(currency, includeOutdated = true) { + const storeKey = includeOutdated ? 'all' : 'current' + + if (!currencies.has(storeKey)) { + const text = includeOutdated ? rawData.join(',') : rawData[0] + currencies.set(storeKey, parseRawData(text)) + } + + return currencies.get(storeKey)[currency] +} +export {getCurrencyName} diff --git a/license b/license new file mode 100644 index 0000000..5aff036 --- /dev/null +++ b/license @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) fisker Cheung (https://www.fiskercheung.com/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/lint-staged.config.cjs b/lint-staged.config.cjs new file mode 100644 index 0000000..f74aa83 --- /dev/null +++ b/lint-staged.config.cjs @@ -0,0 +1,9 @@ +/*! + * config file for `lint-staged` + * + * update: wget -O lint-staged.config.js https://git.io/fjVj9 + * document: https://git.io/fhNpF + * + */ + +module.exports = require('@fisker/lint-staged-config') diff --git a/package.json b/package.json new file mode 100644 index 0000000..fe874b4 --- /dev/null +++ b/package.json @@ -0,0 +1,77 @@ +{ + "name": "chinese-currency", + "version": "0.0.2", + "description": "货币中文信息", + "homepage": "https://github.com/fisker/chinese-currency#readme", + "bugs": { + "url": "https://github.com/fisker/chinese-currency/issues" + }, + "repository": "fisker/chinese-currency", + "funding": "https://github.com/fisker/chinese-currency?sponsor=1", + "license": "MIT", + "author": { + "name": "fisker Cheung", + "email": "lionkay@gmail.com", + "url": "https://www.fiskercheung.com/" + }, + "sideEffects": false, + "type": "module", + "exports": "./index.js", + "files": [ + "index.js" + ], + "scripts": { + "clean": "run-p clean:*", + "clean:dist": "del-cli dist", + "dist": "run-p dist:*", + "dist:npm": "np --yolo --no-yarn", + "format": "run-p format:*", + "format:eslint": "yarn lint:eslint --fix", + "format:markdown": "yarn lint:markdown --fix", + "format:package-json": "sort-package-json \"package.json\" \"packages/*/package.json\"", + "format:prettier": "yarn lint:prettier --write", + "lint": "run-p lint:*", + "lint:eslint": "eslint \"**/*.{js,mjs,cjs,vue}\"", + "lint:markdown": "markdownlint \"**/*.md\" --ignore \"**/node_modules/**\"", + "lint:package-json": "yarn run format:package-json --check", + "lint:prettier": "prettier \"**/*.{css,html,js,cjs,mjs,json,less,md,scss,ts,vue,yaml,yml}\" --check", + "test": "ava", + "test-coverage": "c8 ava", + "release": "run-s format test dist", + "prepare": "husky install", + "generate": "node scripts/generate.js" + }, + "ava": { + "verbose": true + }, + "c8": { + "reporter": [ + "lcov", + "text" + ] + }, + "devDependencies": { + "@fisker/eslint-config": "10.0.1", + "@fisker/eslint-config-ava": "2.0.4", + "@fisker/husky-config": "4.1.1", + "@fisker/lint-staged-config": "3.1.4", + "@fisker/prettier-config": "5.0.2", + "ava": "3.15.0", + "c8": "7.10.0", + "del-cli": "4.0.1", + "eslint": "8.3.0", + "https-proxy-agent": "5.0.0", + "husky": "7.0.4", + "lint-staged": "12.1.2", + "markdownlint-cli": "0.30.0", + "node-fetch": "3.1.0", + "npm-run-all": "4.1.5", + "prettier": "2.4.1", + "sort-package-json": "1.53.1", + "write-prettier-file": "2.1.1" + }, + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" + } +} diff --git a/prettier.config.cjs b/prettier.config.cjs new file mode 100644 index 0000000..49d39b4 --- /dev/null +++ b/prettier.config.cjs @@ -0,0 +1,8 @@ +/*! + * config file for `prettier` + * + * update: wget -O prettier.config.js https://git.io/fjVjd + * document: https://prettier.io/docs/en/options.html + */ + +module.exports = require('@fisker/prettier-config') diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..4256109 --- /dev/null +++ b/readme.md @@ -0,0 +1,38 @@ +# chinese-currency + +[![Build Status][github_actions_badge]][github_actions_link] +[![Coverage][coveralls_badge]][coveralls_link] +[![Npm Version][package_version_badge]][package_link] +[![MIT License][license_badge]][license_link] + +[github_actions_badge]: https://img.shields.io/github/workflow/status/fisker/chinese-currency/CI/main?style=flat-square +[github_actions_link]: https://github.com/fisker/chinese-currency/actions?query=branch%3Amain +[coveralls_badge]: https://img.shields.io/coveralls/github/fisker/chinese-currency/main?style=flat-square +[coveralls_link]: https://coveralls.io/github/fisker/chinese-currency?branch=main +[license_badge]: https://img.shields.io/npm/l/prettier-format.svg?style=flat-square +[license_link]: https://github.com/fisker/chinese-currency/blob/main/license +[package_version_badge]: https://img.shields.io/npm/v/chinese-currency.svg?style=flat-square +[package_link]: https://www.npmjs.com/package/chinese-currency + +> 货币中文信息 + +## 安装 + +```bash +yarn add chinese-currency +``` + +## 使用 + +```js +import {getCurrencyName} from 'chinese-currency' + +console.log(getCurrencyName('CNY')) +//=> 人民币元 +``` + +## API + +### `getCurrencyName(currency, options?)` + +[TBD] diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..cff9d9e --- /dev/null +++ b/renovate.json @@ -0,0 +1,6 @@ +{ + "extends": [ + "@fisker", + ":assignee(fisker)" + ] +} diff --git a/scripts/generate.js b/scripts/generate.js new file mode 100644 index 0000000..a9e0a38 --- /dev/null +++ b/scripts/generate.js @@ -0,0 +1,40 @@ +import writePrettierFile from 'write-prettier-file' +import getData from './get-data.js' + +const PROJECT_ROOT = new URL('../', import.meta.url) +const SCRIPT_FILE = import.meta.url.slice(PROJECT_ROOT.href.length) + +const dataToText = (currencies) => + currencies.map(({code, name}) => `${code}${name}`).join(',') + +const {current, outdated} = await getData() + +const head = ` +/* +DO NOT EDIT THIS FILE + +Auto generated by script \`${SCRIPT_FILE}\` +*/ +` + +await writePrettierFile( + new URL('./currencies-raw.js', PROJECT_ROOT), + ` + + + export default ${JSON.stringify([dataToText(current), dataToText(outdated)])}; +`, +) +await writePrettierFile( + new URL('./currencies.js', PROJECT_ROOT), + ` + /* + * DO NOT EDIT THIS FILE + * + * Auto generated by script \`${SCRIPT_FILE}\` + */ + + export const current = ${JSON.stringify(current)}; + export const outdated = ${JSON.stringify(outdated)}; +`, +) diff --git a/scripts/get-data.js b/scripts/get-data.js new file mode 100644 index 0000000..eb3086e --- /dev/null +++ b/scripts/get-data.js @@ -0,0 +1,66 @@ +/* +"GB/T 12406-2008 表示货币和资金的代码" 完整版可以在以下网站查看到, 但是由PDF转换的图片格式 +http://www.bz360.org:8018/ESA_Query_STD/Details.aspx?a100=GB%2012406-2008 +*/ +import process from 'node:process' +import fetch from 'node-fetch' +import HttpsProxyAgent from 'https-proxy-agent' + +const proxy = + process.env.ALL_PROXY || process.env.HTTPS_PROXY || process.env.HTTP_PROXY +function* parseCurrencyTable(table) { + for (const text of table.split('')) { + const matches = [...text.matchAll(/(?:(.*?)<\/td>)+/g)].map( + ([, text]) => text, + ) + const [code] = matches + if (!code) { + continue + } + const name = matches[3] + .replace(/]*>.*?<\/sup>/g, '') + .replace(/<.*?>/g, '') + .replace(/\[注 \d+]/, '') + .trim() + + yield {code, name} + } +} + +function getCurrentCodes(text) { + const table = text + .split('id="现行代码"')[1] + .split('')[0] + + return [...parseCurrencyTable(table)] +} + +function getOutdatedCodes(text) { + const table = text + .split('id="过时的货币代码"')[1] + .split('')[0] + + return [...parseCurrencyTable(table)] +} + +async function getData() { + const agent = proxy ? new HttpsProxyAgent(proxy) : undefined + + const response = await fetch('https://zh.m.wikipedia.org/wiki/ISO_4217', { + agent, + }) + const text = await response.text() + + return { + // 现行代码 + current: getCurrentCodes(text), + // 过时的货币代码 + outdated: getOutdatedCodes(text), + } +} + +export default getData diff --git a/test.js b/test.js new file mode 100644 index 0000000..96aebbc --- /dev/null +++ b/test.js @@ -0,0 +1,33 @@ +import test from 'ava' +import getData from './scripts/get-data.js' +import * as currencies from './currencies.js' +import {getCurrencyName} from './index.js' + +const isUnique = (array) => + array.every((element, index) => array.indexOf(element) === index) + +test('currencies', (t) => { + t.true(Array.isArray(currencies.current)) + t.true(Array.isArray(currencies.outdated)) + + t.true( + isUnique( + [...currencies.current, ...currencies.outdated].map(({code}) => code), + ), + ) +}) + +test('getCurrencyName', (t) => { + t.is(getCurrencyName('CNY'), '人民币元') + t.is(getCurrencyName('SUR'), '苏联卢布') + t.is(getCurrencyName('CNY', /* includeOutdated */ false), '人民币元') + t.is(getCurrencyName('SUR', /* includeOutdated */ false), undefined) +}) + +test('data should be updated', async (t) => { + const {current, outdated} = await getData() + t.deepEqual(current, currencies.current) + t.deepEqual(outdated, currencies.outdated) + t.is(current.length, 177) + t.is(outdated.length, 108) +})