diff --git a/package.json b/package.json index 9e52ed0..5846f65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "pinyin", - "version": "2.2.0", + "name": "pinyinjs", + "version": "2.2.1", "description": "汉语拼音转换工具。", "main": "src/pinyin.js", "bin": { diff --git a/src/pinyin.js b/src/pinyin.js index f642b08..579df02 100644 --- a/src/pinyin.js +++ b/src/pinyin.js @@ -101,7 +101,6 @@ function single_pinyin(han, options){ return single_pinyin(han.charAt(0), options); } - options = extend(DEFAULT_OPTIONS, options); var hanCode = han.charCodeAt(0); if(!PINYIN_DICT[hanCode]){return [han];} @@ -155,7 +154,7 @@ function pinyin(hans, options){ if("string" !== typeof hans){return [];} - options = extend(DEFAULT_OPTIONS, options); + options = extend(DEFAULT_OPTIONS, options || {}); var phrases = segment.doSegment(hans); var len = hans.length;