gm-util 5.12.10-beta.1 → 5.13.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ name: Publish to NPM
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ publish:
11
+ runs-on: ubuntu-latest
12
+
13
+ permissions:
14
+ contents: read
15
+ id-token: write
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Setup Node.js
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version: '18'
25
+ registry-url: 'https://registry.npmjs.org'
26
+ cache: 'yarn'
27
+
28
+ - name: Install dependencies
29
+ run: yarn install --frozen-lockfile
30
+
31
+ - name: Publish to NPM
32
+ run: npm publish --registry='https://registry.npmjs.org'
33
+ env:
34
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-util",
3
- "version": "5.12.10-beta.1",
3
+ "version": "5.13.0-beta.1",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/pinyin.js CHANGED
@@ -703,9 +703,8 @@ const pinyin = (source, style) => {
703
703
  if (compareResult < 0) {
704
704
  index--
705
705
  }
706
- const targetPinyin = pinyins[index] || ''
707
- cache[target] = targetPinyin
708
- return (style === 'first_letter') ? targetPinyin.charAt(0) : targetPinyin
706
+ cache[target] = pinyins[index]
707
+ return (style === 'first_letter') ? pinyins[index].charAt(0) : pinyins[index]
709
708
  }
710
709
 
711
710
  const _pinyin = (source, style) => {