Skip to content

Commit 19e3ed7

Browse files
committed
docs(readme): 例を追加
1 parent b65188d commit 19e3ed7

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ Configure `"max"` value of the `.textlintrc` file.
2828
}
2929
```
3030

31+
## Example
32+
33+
> これは、長文の例ですが、読点の数が3つ以上あるので、エラーが報告されます。
34+
35+
=> error 一つの文で"、"を3つ以上使用しています
36+
37+
> ビスケットの主な材料は(1)小麦粉、(2)牛乳、(3)ショートニング、(4)バター、(5)砂糖である。
38+
39+
=> No error: 名詞同士で囲まれている `` はカウントされない
40+
3141
## Tests
3242

3343
npm test

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
},
4242
"dependencies": {
4343
"kuromojin": "^1.0.2",
44-
"object-assign": "^4.0.1",
4544
"sentence-splitter": "^1.2.0",
4645
"structured-source": "^3.0.2",
4746
"textlint-rule-helper": "^1.1.3"

src/max-ten.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// LICENSE : MIT
22
"use strict";
33
import {RuleHelper} from "textlint-rule-helper"
4-
import ObjectAssign from "object-assign"
54
import {getTokenizer} from "kuromojin";
65
import splitSentences from "sentence-splitter";
76
import Source from "structured-source";
@@ -22,8 +21,7 @@ function isSandwichedMeishi({
2221
* @param {object} options
2322
*/
2423
export default function (context, options = {}) {
25-
options = ObjectAssign({}, defaultOptions, options);
26-
const maxLen = options.max;
24+
const maxLen = options.max || defaultOptions.max;
2725
let helper = new RuleHelper(context);
2826
let {Syntax, RuleError, report, getSource} = context;
2927
return {

test/max-ten-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ tester.run("max-ten", rule, {
99
// default max:3
1010
valid: [
1111
"名詞、名詞、名詞、名詞の場合は例外",
12+
"ビスケットの主な材料は(1)小麦粉、(2)牛乳、(3)ショートニング、(4)バター、(5)砂糖である。",
1213
{
1314
text: textIncludeTen(3 - 1)
1415
},

0 commit comments

Comments
 (0)