micromark-util-character
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
export function asciiControl(code: Code): boolean | ||
export function asciiControl(code: Code): boolean; | ||
/** | ||
@@ -29,3 +29,3 @@ * Check whether a character code is a markdown line ending. | ||
*/ | ||
export function markdownLineEnding(code: Code): boolean | ||
export function markdownLineEnding(code: Code): boolean; | ||
/** | ||
@@ -40,3 +40,3 @@ * Check whether a character code is a markdown line ending (see | ||
*/ | ||
export function markdownLineEndingOrSpace(code: Code): boolean | ||
export function markdownLineEndingOrSpace(code: Code): boolean; | ||
/** | ||
@@ -57,30 +57,12 @@ * Check whether a character code is a markdown space. | ||
*/ | ||
export function markdownSpace(code: Code): boolean | ||
/** | ||
* Check whether the character code represents Unicode punctuation. | ||
* | ||
* A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, | ||
* Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` | ||
* (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` | ||
* (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII | ||
* punctuation (see `asciiPunctuation`). | ||
* | ||
* See: | ||
* **\[UNICODE]**: | ||
* [The Unicode Standard](https://www.unicode.org/versions/). | ||
* Unicode Consortium. | ||
* | ||
* @param {Code} code | ||
* Code. | ||
* @returns {boolean} | ||
* Whether it matches. | ||
*/ | ||
export function unicodePunctuation(code: Code): boolean | ||
export function asciiAlpha(code: Code): boolean | ||
export function asciiAlphanumeric(code: Code): boolean | ||
export function asciiAtext(code: Code): boolean | ||
export function asciiDigit(code: Code): boolean | ||
export function asciiHexDigit(code: Code): boolean | ||
export function asciiPunctuation(code: Code): boolean | ||
export function unicodeWhitespace(code: Code): boolean | ||
export type Code = import('micromark-util-types').Code | ||
export function markdownSpace(code: Code): boolean; | ||
export function asciiAlpha(code: Code): boolean; | ||
export function asciiAlphanumeric(code: Code): boolean; | ||
export function asciiAtext(code: Code): boolean; | ||
export function asciiDigit(code: Code): boolean; | ||
export function asciiHexDigit(code: Code): boolean; | ||
export function asciiPunctuation(code: Code): boolean; | ||
export function unicodePunctuation(code: Code): boolean; | ||
export function unicodeWhitespace(code: Code): boolean; | ||
export type Code = import('micromark-util-types').Code; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,4 +7,2 @@ /** | ||
const unicodePunctuationInternal = regexCheck(/\p{P}/u) | ||
/** | ||
@@ -204,10 +202,8 @@ * Check whether the character code represents an ASCII alpha (`a` through `z`, | ||
* | ||
* @param {Code} code | ||
* @param code | ||
* Code. | ||
* @returns {boolean} | ||
* @returns | ||
* Whether it matches. | ||
*/ | ||
export function unicodePunctuation(code) { | ||
return asciiPunctuation(code) || unicodePunctuationInternal(code) | ||
} | ||
export const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u) | ||
@@ -231,3 +227,3 @@ /** | ||
* Code. | ||
* @returns {boolean} | ||
* @returns | ||
* Whether it matches. | ||
@@ -234,0 +230,0 @@ */ |
@@ -12,3 +12,3 @@ /** | ||
*/ | ||
export function asciiControl(code: Code): boolean | ||
export function asciiControl(code: Code): boolean; | ||
/** | ||
@@ -29,3 +29,3 @@ * Check whether a character code is a markdown line ending. | ||
*/ | ||
export function markdownLineEnding(code: Code): boolean | ||
export function markdownLineEnding(code: Code): boolean; | ||
/** | ||
@@ -40,3 +40,3 @@ * Check whether a character code is a markdown line ending (see | ||
*/ | ||
export function markdownLineEndingOrSpace(code: Code): boolean | ||
export function markdownLineEndingOrSpace(code: Code): boolean; | ||
/** | ||
@@ -57,30 +57,12 @@ * Check whether a character code is a markdown space. | ||
*/ | ||
export function markdownSpace(code: Code): boolean | ||
/** | ||
* Check whether the character code represents Unicode punctuation. | ||
* | ||
* A **Unicode punctuation** is a character in the Unicode `Pc` (Punctuation, | ||
* Connector), `Pd` (Punctuation, Dash), `Pe` (Punctuation, Close), `Pf` | ||
* (Punctuation, Final quote), `Pi` (Punctuation, Initial quote), `Po` | ||
* (Punctuation, Other), or `Ps` (Punctuation, Open) categories, or an ASCII | ||
* punctuation (see `asciiPunctuation`). | ||
* | ||
* See: | ||
* **\[UNICODE]**: | ||
* [The Unicode Standard](https://www.unicode.org/versions/). | ||
* Unicode Consortium. | ||
* | ||
* @param {Code} code | ||
* Code. | ||
* @returns {boolean} | ||
* Whether it matches. | ||
*/ | ||
export function unicodePunctuation(code: Code): boolean | ||
export function asciiAlpha(code: Code): boolean | ||
export function asciiAlphanumeric(code: Code): boolean | ||
export function asciiAtext(code: Code): boolean | ||
export function asciiDigit(code: Code): boolean | ||
export function asciiHexDigit(code: Code): boolean | ||
export function asciiPunctuation(code: Code): boolean | ||
export function unicodeWhitespace(code: Code): boolean | ||
export type Code = import('micromark-util-types').Code | ||
export function markdownSpace(code: Code): boolean; | ||
export function asciiAlpha(code: Code): boolean; | ||
export function asciiAlphanumeric(code: Code): boolean; | ||
export function asciiAtext(code: Code): boolean; | ||
export function asciiDigit(code: Code): boolean; | ||
export function asciiHexDigit(code: Code): boolean; | ||
export function asciiPunctuation(code: Code): boolean; | ||
export function unicodePunctuation(code: Code): boolean; | ||
export function unicodeWhitespace(code: Code): boolean; | ||
export type Code = import('micromark-util-types').Code; | ||
//# sourceMappingURL=index.d.ts.map |
40
index.js
@@ -5,4 +5,2 @@ /** | ||
const unicodePunctuationInternal = regexCheck(/\p{P}/u) | ||
/** | ||
@@ -25,3 +23,3 @@ * Check whether the character code represents an ASCII alpha (`a` through `z`, | ||
*/ | ||
export const asciiAlpha = regexCheck(/[A-Za-z]/) | ||
export const asciiAlpha = regexCheck(/[A-Za-z]/); | ||
@@ -40,3 +38,3 @@ /** | ||
*/ | ||
export const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/) | ||
export const asciiAlphanumeric = regexCheck(/[\dA-Za-z]/); | ||
@@ -64,3 +62,3 @@ /** | ||
*/ | ||
export const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/) | ||
export const asciiAtext = regexCheck(/[#-'*+\--9=?A-Z^-~]/); | ||
@@ -83,3 +81,3 @@ /** | ||
code !== null && (code < 32 || code === 127) | ||
) | ||
); | ||
} | ||
@@ -98,3 +96,3 @@ | ||
*/ | ||
export const asciiDigit = regexCheck(/\d/) | ||
export const asciiDigit = regexCheck(/\d/); | ||
@@ -119,3 +117,3 @@ /** | ||
*/ | ||
export const asciiHexDigit = regexCheck(/[\dA-Fa-f]/) | ||
export const asciiHexDigit = regexCheck(/[\dA-Fa-f]/); | ||
@@ -135,3 +133,3 @@ /** | ||
*/ | ||
export const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/) | ||
export const asciiPunctuation = regexCheck(/[!-/:-@[-`{-~]/); | ||
@@ -154,3 +152,3 @@ /** | ||
export function markdownLineEnding(code) { | ||
return code !== null && code < -2 | ||
return code !== null && code < -2; | ||
} | ||
@@ -168,3 +166,3 @@ | ||
export function markdownLineEndingOrSpace(code) { | ||
return code !== null && (code < 0 || code === 32) | ||
return code !== null && (code < 0 || code === 32); | ||
} | ||
@@ -188,3 +186,3 @@ | ||
export function markdownSpace(code) { | ||
return code === -2 || code === -1 || code === 32 | ||
return code === -2 || code === -1 || code === 32; | ||
} | ||
@@ -208,10 +206,8 @@ | ||
* | ||
* @param {Code} code | ||
* @param code | ||
* Code. | ||
* @returns {boolean} | ||
* @returns | ||
* Whether it matches. | ||
*/ | ||
export function unicodePunctuation(code) { | ||
return asciiPunctuation(code) || unicodePunctuationInternal(code) | ||
} | ||
export const unicodePunctuation = regexCheck(/\p{P}|\p{S}/u); | ||
@@ -235,6 +231,6 @@ /** | ||
* Code. | ||
* @returns {boolean} | ||
* @returns | ||
* Whether it matches. | ||
*/ | ||
export const unicodeWhitespace = regexCheck(/\s/) | ||
export const unicodeWhitespace = regexCheck(/\s/); | ||
@@ -248,3 +244,3 @@ /** | ||
function regexCheck(regex) { | ||
return check | ||
return check; | ||
@@ -260,4 +256,4 @@ /** | ||
function check(code) { | ||
return code !== null && code > -1 && regex.test(String.fromCharCode(code)) | ||
return code !== null && code > -1 && regex.test(String.fromCharCode(code)); | ||
} | ||
} | ||
} |
{ | ||
"name": "micromark-util-character", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "micromark utility to handle character codes", | ||
@@ -33,2 +33,3 @@ "license": "MIT", | ||
"lib/", | ||
"index.d.ts.map", | ||
"index.d.ts", | ||
@@ -48,3 +49,11 @@ "index.js" | ||
}, | ||
"xo": false | ||
"xo": { | ||
"envs": [ | ||
"shared-node-browser" | ||
], | ||
"prettier": true, | ||
"rules": { | ||
"unicorn/prefer-code-point": "off" | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8
33105
590