Skip to content

Commit

Permalink
重构
Browse files Browse the repository at this point in the history
  • Loading branch information
aui committed Aug 14, 2017
1 parent 1fe5eaf commit 7d35120
Show file tree
Hide file tree
Showing 11 changed files with 333 additions and 109 deletions.
8 changes: 3 additions & 5 deletions .eslintrc.json
@@ -1,14 +1,12 @@
{
"env": {
"browser": true,
"browser": false,
"commonjs": true,
"es6": true,
"node": true
"node": true,
"mocha": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"rules": {
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
@@ -1 +1,2 @@
node_modules
node_modules
.vscode
2 changes: 1 addition & 1 deletion dist/cn.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/tw.js

Large diffs are not rendered by default.

67 changes: 28 additions & 39 deletions example/index.html

Large diffs are not rendered by default.

188 changes: 188 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -7,7 +7,7 @@
"example": "example"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha"
},
"repository": {
"type": "git",
Expand All @@ -26,6 +26,7 @@
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-preset-env": "^1.6.0",
"mocha": "^3.5.0",
"webpack": "^3.5.3"
}
}
9 changes: 9 additions & 0 deletions src/cn.js
Expand Up @@ -13,6 +13,15 @@ class PinyinEngine extends Engine {
constructor(data, indexs) {
super(data, indexs, DICT);
}

/**
* 将内容进行分词
* @param {string} words 目标字符串
* @return {string}
*/
static participle(keyword) {
return Engine.participle(keyword, DICT);
}
}

module.exports = PinyinEngine;

0 comments on commit 7d35120

Please sign in to comment.