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

textlint-rule-ja-unnatural-alphabet

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

textlint-rule-ja-unnatural-alphabet - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

16

lib/textlint-rule-ja-unnatural-alphabet.js

@@ -72,7 +72,15 @@ // MIT © 2017 azu

/**
* ビルトインの無視するリスト
* @type {[*]}
*/
var builtInCommonAllow = ["/[a-zA-Za-zA-Z]言語/", "/[x-zX-Z]座標/", "/[x-zX-Z]軸/", "Eメール"];
var defaultOptions = {
// 無視するアルファベット
// 例) ["X"]
// デフォルトでは母音とnと典型例を除外している
"allow": ["a", "i", "u", "e", "o", "n", "/[a-zA-Za-zA-Z]言語/", "/[x-zX-Z]座標/", "/[x-zX-Z]軸/", "Eメール"]
// デフォルトでは母音とnを除外
"allow": ["a", "i", "u", "e", "o", "n"],
// ビルトインの典型例を除外するかどうか
// 例) C言語
"allowCommonCase": true
};

@@ -87,5 +95,7 @@ var report = function report(context) {

var allowAlphabets = options.allow || defaultOptions.allow;
var allowCommonCase = options.allowCommonCase !== undefined ? options.allowCommonCase : defaultOptions.allowCommonCase;
var allow = allowCommonCase ? allowAlphabets.concat(builtInCommonAllow) : allowAlphabets;
return _defineProperty({}, Syntax.Str, function (node) {
var text = getSource(node);
var ignoreMatch = createIgnoreRanges(text, allowAlphabets);
var ignoreMatch = createIgnoreRanges(text, allow);
matchUnnaturalAlphabet(text).forEach(function (actual) {

@@ -92,0 +102,0 @@ var text = actual.text,

2

package.json

@@ -13,3 +13,3 @@ {

"name": "textlint-rule-ja-unnatural-alphabet",
"version": "1.2.0",
"version": "1.3.0",
"description": "不自然なアルファベットを検知するtextlintルール",

@@ -16,0 +16,0 @@ "main": "lib/textlint-rule-ja-unnatural-alphabet.js",

@@ -59,3 +59,10 @@ # textlint-rule-ja-unnatural-alphabet [![Build Status](https://travis-ci.org/textlint-ja/textlint-rule-ja-unnatural-alphabet.svg?branch=master)](https://travis-ci.org/textlint-ja/textlint-rule-ja-unnatural-alphabet)

// 無視するアルファベット
"allow": ["X"]
// 例) ["X"]
// デフォルトでは母音とnを除外
"allow": [
"a", "i", "u", "e", "o", "n"
],
// ビルトインの典型例を除外するかどうか
// 例) C言語
"allowCommonCase": true
}

@@ -62,0 +69,0 @@ ```

@@ -61,14 +61,22 @@ // MIT © 2017 azu

/**
* ビルトインの無視するリスト
* @type {[*]}
*/
const builtInCommonAllow = [
"/[a-zA-Za-zA-Z]言語/",
"/[x-zX-Z]座標/",
"/[x-zX-Z]軸/",
"Eメール"
];
const defaultOptions = {
// 無視するアルファベット
// 例) ["X"]
// デフォルトでは母音とnと典型例を除外している
// デフォルトでは母音とnを除外
"allow": [
"a", "i", "u", "e", "o",
"n",
"/[a-zA-Za-zA-Z]言語/",
"/[x-zX-Z]座標/",
"/[x-zX-Z]軸/",
"Eメール"
]
"a", "i", "u", "e", "o", "n"
],
// ビルトインの典型例を除外するかどうか
// 例) C言語
"allowCommonCase": true
};

@@ -78,6 +86,10 @@ const report = (context, options = {}) => {

const allowAlphabets = options.allow || defaultOptions.allow;
const allowCommonCase = options.allowCommonCase !== undefined
? options.allowCommonCase
: defaultOptions.allowCommonCase;
const allow = allowCommonCase ? allowAlphabets.concat(builtInCommonAllow) : allowAlphabets;
return {
[Syntax.Str](node){
const text = getSource(node);
const ignoreMatch = createIgnoreRanges(text, allowAlphabets);
const ignoreMatch = createIgnoreRanges(text, allow);
matchUnnaturalAlphabet(text).forEach((actual) => {

@@ -84,0 +96,0 @@ const { text, index } = actual;

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