Skip to content

Commit

Permalink
新增了 fullChar API,原有的 start API 改为 firstChar,完善了readme说明文档
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfred-kai committed Jan 18, 2019
1 parent ebc1d35 commit ba7255b
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
}
})(function(){
return {
start(str) {
firstChar(str) {
var firstStr = ''
for (var i = 0; i < str.length; i++) {
var code = str.charCodeAt(i)
Expand All @@ -33,6 +33,22 @@
}
}
return firstStr
},
fullChar(str){
var fullStr = ''
for (var i = 0; i < str.length; i++) {
var code = str.charCodeAt(i)
if (code >= 19968 && code <= 40869) {
for (var item in PinYin) {
if (PinYin.hasOwnProperty(item)) {
if (PinYin[item].indexOf(str[i]) > -1) {
fullStr += item
}
}
}
}
}
return fullStr
}
}
})
Expand Down

0 comments on commit ba7255b

Please sign in to comment.