New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

textlint-rule-max-ten

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

textlint-rule-max-ten - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

69

lib/max-ten.js

@@ -49,35 +49,40 @@ // LICENSE : MIT

currentParagraphTexts.push(node);
}), _defineProperty(_ref, Syntax.Paragraph + ":exit", function (pNode) {
}), _defineProperty(_ref, Syntax.Paragraph + ":exit", function () {
var currentTenCount = 0;
var text = currentParagraphTexts.map(function (strNode) {
return getSource(strNode);
}).join("\n");
var characters = text.split(""); // ["t","e","x","t"]
var paddingLine = 0;
var paddingColumn = 0;
characters.forEach(function (char) {
if (char === "、") {
currentTenCount++;
}
if (char === "。") {
// reset
currentTenCount = 0;
}
// report
if (currentTenCount >= maxLen) {
var ruleError = new context.RuleError("一つの文で\"、\"を" + maxLen + "つ以上使用しています", {
line: paddingLine,
column: paddingColumn
});
report(pNode, ruleError);
currentTenCount = 0;
}
// calc padding{line,column}
if (char === "\n") {
paddingLine++;
paddingColumn = 0;
} else {
paddingColumn++;
}
/*
<p>
<str><code><img><str>
<str>
</p>
*/
currentParagraphTexts.forEach(function (strNode) {
var paddingLine = 0;
var paddingColumn = 0;
var text = getSource(strNode);
var characters = text.split("");
characters.forEach(function (char) {
if (char === "、") {
currentTenCount++;
}
if (char === "。") {
// reset
currentTenCount = 0;
}
// report
if (currentTenCount >= maxLen) {
var ruleError = new context.RuleError("一つの文で\"、\"を" + maxLen + "つ以上使用しています", {
line: paddingLine,
column: paddingColumn
});
report(strNode, ruleError);
currentTenCount = 0;
}
// calc padding{line,column}
if (char === "\n") {
paddingLine++;
paddingColumn = 0;
} else {
paddingColumn++;
}
});
});

@@ -84,0 +89,0 @@ }), _ref);

@@ -18,3 +18,3 @@ {

},
"version": "1.2.1",
"version": "1.2.2",
"description": "textlint rule that limit maxinum ten(、) count of sentence.",

@@ -21,0 +21,0 @@ "main": "lib/max-ten.js",

@@ -31,33 +31,40 @@ // LICENSE : MIT

},
[Syntax.Paragraph + ":exit"](pNode){
[Syntax.Paragraph + ":exit"](){
let currentTenCount = 0;
let text = currentParagraphTexts.map(strNode => getSource(strNode)).join("\n");
let characters = text.split("");// ["t","e","x","t"]
let paddingLine = 0;
let paddingColumn = 0;
characters.forEach(char => {
if (char === "、") {
currentTenCount++;
}
if (char === "。") {
// reset
currentTenCount = 0;
}
// report
if (currentTenCount >= maxLen) {
var ruleError = new context.RuleError(`一つの文で"、"を${maxLen}つ以上使用しています`, {
line: paddingLine,
column: paddingColumn
});
report(pNode, ruleError);
currentTenCount = 0;
}
// calc padding{line,column}
if (char === "\n") {
paddingLine++;
paddingColumn = 0;
} else {
paddingColumn++;
}
/*
<p>
<str><code><img><str>
<str>
</p>
*/
currentParagraphTexts.forEach(strNode => {
let paddingLine = 0;
let paddingColumn = 0;
let text = getSource(strNode);
let characters = text.split("");
characters.forEach(char => {
if (char === "、") {
currentTenCount++;
}
if (char === "。") {
// reset
currentTenCount = 0;
}
// report
if (currentTenCount >= maxLen) {
var ruleError = new context.RuleError(`一つの文で"、"を${maxLen}つ以上使用しています`, {
line: paddingLine,
column: paddingColumn
});
report(strNode, ruleError);
currentTenCount = 0;
}
// calc padding{line,column}
if (char === "\n") {
paddingLine++;
paddingColumn = 0;
} else {
paddingColumn++;
}
});
});

@@ -64,0 +71,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc