textlint-rule-max-comma
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -9,3 +9,2 @@ // LICENSE : MIT | ||
var filter = require("unist-util-filter"); | ||
var StringSource = require("textlint-util-to-string"); | ||
function countOfComma(text) { | ||
@@ -31,4 +30,9 @@ return text.split(",").length - 1; | ||
}); | ||
var source = new StringSource(nodeWithoutCode); | ||
var text = source.toString(); | ||
if (!nodeWithoutCode) { | ||
return; | ||
} | ||
var texts = Array.isArray(nodeWithoutCode.children) ? nodeWithoutCode.children.map(function (child) { | ||
return getSource(child); | ||
}) : []; | ||
var text = texts.join(""); | ||
var sentences = (0, _sentenceSplitter.split)(text).filter(function (node) { | ||
@@ -35,0 +39,0 @@ return node.type === _sentenceSplitter.Syntax.Sentence; |
{ | ||
"name": "textlint-rule-max-comma", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "textlint rule that limit maxinum comma(,) count of sentence.", | ||
@@ -42,5 +42,4 @@ "main": "lib/textlint-rule-max-comma.js", | ||
"sentence-splitter": "^2.0.0", | ||
"textlint-util-to-string": "^2.0.0", | ||
"unist-util-filter": "^0.2.1" | ||
} | ||
} |
@@ -5,3 +5,2 @@ // LICENSE : MIT | ||
const filter = require("unist-util-filter"); | ||
const StringSource = require("textlint-util-to-string"); | ||
function countOfComma(text) { | ||
@@ -22,4 +21,9 @@ return text.split(",").length - 1; | ||
}); | ||
const source = new StringSource(nodeWithoutCode); | ||
const text = source.toString(); | ||
if (!nodeWithoutCode) { | ||
return; | ||
} | ||
const texts = Array.isArray(nodeWithoutCode.children) ? nodeWithoutCode.children.map(child => { | ||
return getSource(child); | ||
}) : []; | ||
const text = texts.join(""); | ||
const sentences = split(text).filter(node => node.type === SentenceSyntax.Sentence); | ||
@@ -26,0 +30,0 @@ sentences.forEach(sentence => { |
Sorry, the diff of this file is not supported yet
10086
2
86
- Removedtextlint-util-to-string@^2.0.0
- Removedobject-assign@4.1.1(transitive)
- Removedtextlint-util-to-string@2.1.1(transitive)