gm-util 5.12.9 → 5.12.10-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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/pinyin.js +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-util",
3
- "version": "5.12.9",
3
+ "version": "5.12.10-beta.1",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/pinyin.js CHANGED
@@ -703,8 +703,9 @@ const pinyin = (source, style) => {
703
703
  if (compareResult < 0) {
704
704
  index--
705
705
  }
706
- cache[target] = pinyins[index]
707
- return (style === 'first_letter') ? pinyins[index].charAt(0) : pinyins[index]
706
+ const targetPinyin = pinyins[index] || ''
707
+ cache[target] = targetPinyin
708
+ return (style === 'first_letter') ? targetPinyin.charAt(0) : targetPinyin
708
709
  }
709
710
 
710
711
  const _pinyin = (source, style) => {