Comparing version 6.0.0 to 6.1.0
// This file is generated by `build.js`. | ||
/** @type {Record<string, RegExp>} */ | ||
export const expressions = { | ||
cmn: /[\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u3005\u3007\u3021-\u3029\u3038-\u303B\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFA6D\uFA70-\uFAD9]|\uD81B[\uDFE2\uDFE3\uDFF0\uDFF1]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A]/g, | ||
cmn: /[\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u3005\u3007\u3021-\u3029\u3038-\u303B\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFA6D\uFA70-\uFAD9]|\uD81B[\uDFE2\uDFE3\uDFF0\uDFF1]|[\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883\uD885-\uD887][\uDC00-\uDFFF]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF39\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A\uDF50-\uDFFF]|\uD888[\uDC00-\uDFAF]/g, | ||
Latin: | ||
/[A-Za-z\u00AA\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uAB66-\uAB69\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A]|\uD801[\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD837[\uDF00-\uDF1E]/g, | ||
/[A-Za-z\u00AA\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u02E0-\u02E4\u1D00-\u1D25\u1D2C-\u1D5C\u1D62-\u1D65\u1D6B-\u1D77\u1D79-\u1DBE\u1E00-\u1EFF\u2071\u207F\u2090-\u209C\u212A\u212B\u2132\u214E\u2160-\u2188\u2C60-\u2C7F\uA722-\uA787\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA7FF\uAB30-\uAB5A\uAB5C-\uAB64\uAB66-\uAB69\uFB00-\uFB06\uFF21-\uFF3A\uFF41-\uFF5A]|\uD801[\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD837[\uDF00-\uDF1E\uDF25-\uDF2A]/g, | ||
Cyrillic: | ||
/[\u0400-\u0484\u0487-\u052F\u1C80-\u1C88\u1D2B\u1D78\u2DE0-\u2DFF\uA640-\uA69F\uFE2E\uFE2F]/g, | ||
/[\u0400-\u0484\u0487-\u052F\u1C80-\u1C88\u1D2B\u1D78\u2DE0-\u2DFF\uA640-\uA69F\uFE2E\uFE2F]|\uD838[\uDC30-\uDC6D\uDC8F]/g, | ||
Arabic: | ||
/[\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u06FF\u0750-\u077F\u0870-\u088E\u0890\u0891\u0898-\u08E1\u08E3-\u08FF\uFB50-\uFBC2\uFBD3-\uFD3D\uFD40-\uFD8F\uFD92-\uFDC7\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD803[\uDE60-\uDE7E]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/g, | ||
/[\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061C-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F\u0671-\u06DC\u06DE-\u06FF\u0750-\u077F\u0870-\u088E\u0890\u0891\u0898-\u08E1\u08E3-\u08FF\uFB50-\uFBC2\uFBD3-\uFD3D\uFD40-\uFD8F\uFD92-\uFDC7\uFDCF\uFDF0-\uFDFF\uFE70-\uFE74\uFE76-\uFEFC]|\uD803[\uDE60-\uDE7E\uDEFD-\uDEFF]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB\uDEF0\uDEF1]/g, | ||
ben: /[\u0980-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09FE]/g, | ||
Devanagari: /[\u0900-\u0950\u0955-\u0963\u0966-\u097F\uA8E0-\uA8FF]/g, | ||
jpn: /[\u3041-\u3096\u309D-\u309F]|\uD82C[\uDC01-\uDD1F\uDD50-\uDD52]|\uD83C\uDE00|[\u30A1-\u30FA\u30FD-\u30FF\u31F0-\u31FF\u32D0-\u32FE\u3300-\u3357\uFF66-\uFF6F\uFF71-\uFF9D]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00\uDD20-\uDD22\uDD64-\uDD67]|[㐀-䶵一-龯]/g, | ||
Devanagari: | ||
/[\u0900-\u0950\u0955-\u0963\u0966-\u097F\uA8E0-\uA8FF]|\uD806[\uDF00-\uDF09]/g, | ||
jpn: /[\u3041-\u3096\u309D-\u309F]|\uD82C[\uDC01-\uDD1F\uDD32\uDD50-\uDD52]|\uD83C\uDE00|[\u30A1-\u30FA\u30FD-\u30FF\u31F0-\u31FF\u32D0-\u32FE\u3300-\u3357\uFF66-\uFF6F\uFF71-\uFF9D]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00\uDD20-\uDD22\uDD55\uDD64-\uDD67]|[㐀-䶵一-龯]/g, | ||
jav: /[\uA980-\uA9CD\uA9D0-\uA9D9\uA9DE\uA9DF]/g, | ||
@@ -19,3 +20,3 @@ kor: /[\u1100-\u11FF\u302E\u302F\u3131-\u318E\u3200-\u321E\u3260-\u327E\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFFA0-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/g, | ||
guj: /[\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AF1\u0AF9-\u0AFF]/g, | ||
kan: /[\u0C80-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2]/g, | ||
kan: /[\u0C80-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDD\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1-\u0CF3]/g, | ||
mal: /[\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4F\u0D54-\u0D63\u0D66-\u0D7F]/g, | ||
@@ -22,0 +23,0 @@ mya: /[\u1000-\u109F\uA9E0-\uA9FE\uAA60-\uAA7F]/g, |
@@ -6,3 +6,3 @@ /** | ||
* The value to test. | ||
* @param {Object} [options] | ||
* @param {Options} [options] | ||
* Configuration. | ||
@@ -14,3 +14,3 @@ * @return {string} | ||
value?: string | undefined, | ||
options?: Object | undefined | ||
options?: Options | undefined | ||
): string | ||
@@ -25,3 +25,3 @@ /** | ||
* Configuration. | ||
* @return {TrigramTuple[]} | ||
* @return {Array<TrigramTuple>} | ||
* An array containing language—distance tuples. | ||
@@ -32,17 +32,17 @@ */ | ||
options?: Options | undefined | ||
): import('trigram-utils').TrigramTuple[] | ||
): Array<import('trigram-utils').TrigramTuple> | ||
export type TrigramTuple = import('trigram-utils').TrigramTuple | ||
export type Options = { | ||
/** | ||
* allow languages | ||
* Languages to allow. | ||
*/ | ||
only?: string[] | undefined | ||
/** | ||
* disallow languages | ||
* Languages to ignore. | ||
*/ | ||
ignore?: string[] | undefined | ||
/** | ||
* minimum length to accept | ||
* Minimum length to accept. | ||
*/ | ||
minLength?: number | undefined | ||
} |
44
index.js
@@ -6,8 +6,8 @@ // This file is generated by `build.js` | ||
* @typedef Options | ||
* @property {string[]} [only] | ||
* allow languages | ||
* @property {string[]} [ignore] | ||
* disallow languages | ||
* @property {Array<string>} [only] | ||
* Languages to allow. | ||
* @property {Array<string>} [ignore] | ||
* Languages to ignore. | ||
* @property {number} [minLength=10] | ||
* minimum length to accept | ||
* Minimum length to accept. | ||
*/ | ||
@@ -76,3 +76,3 @@ | ||
* The value to test. | ||
* @param {Object} [options] | ||
* @param {Options} [options] | ||
* Configuration. | ||
@@ -94,10 +94,10 @@ * @return {string} | ||
* Configuration. | ||
* @return {TrigramTuple[]} | ||
* @return {Array<TrigramTuple>} | ||
* An array containing language—distance tuples. | ||
*/ | ||
export function francAll(value, options = {}) { | ||
/** @type {string[]} */ | ||
/** @type {Array<string>} */ | ||
// @ts-expect-error: `whitelist` is from long ago. | ||
const only = [...(options.whitelist || []), ...(options.only || [])] | ||
/** @type {string[]} */ | ||
/** @type {Array<string>} */ | ||
// @ts-expect-error: `blacklist` is from long ago. | ||
@@ -145,5 +145,5 @@ const ignore = [...(options.blacklist || []), ...(options.ignore || [])] | ||
* Value to normalize. | ||
* @param {TrigramTuple[]} distances | ||
* @param {Array<TrigramTuple>} distances | ||
* List of distances. | ||
* @return {TrigramTuple[]} | ||
* @return {Array<TrigramTuple>} | ||
* Normalized distances. | ||
@@ -215,11 +215,11 @@ */ | ||
* | ||
* @param {TrigramTuple[]} trigrams | ||
* @param {Array<TrigramTuple>} trigrams | ||
* An array containing trigram—count tuples. | ||
* @param {Record<string, Record<string, number>>} languages | ||
* Multiple trigrams to test against. | ||
* @param {string[]} only | ||
* @param {Array<string>} only | ||
* Allowed languages; if non-empty, only included languages are kept. | ||
* @param {string[]} ignore | ||
* @param {Array<string>} ignore | ||
* Disallowed languages; included languages are ignored. | ||
* @return {TrigramTuple[]} An array | ||
* @return {Array<TrigramTuple>} An array | ||
* containing language—distance tuples. | ||
@@ -230,3 +230,3 @@ */ | ||
/** @type {TrigramTuple[]} */ | ||
/** @type {Array<TrigramTuple>} */ | ||
const distances = [] | ||
@@ -251,3 +251,3 @@ /** @type {string} */ | ||
* | ||
* @param {TrigramTuple[]} trigrams | ||
* @param {Array<TrigramTuple>} trigrams | ||
* An array containing trigram—count tuples. | ||
@@ -287,5 +287,5 @@ * @param {Record<string, number>} model | ||
* Languages to filter | ||
* @param {string[]} only | ||
* @param {Array<string>} only | ||
* Allowed languages; if non-empty, only included languages are kept. | ||
* @param {string[]} ignore | ||
* @param {Array<string>} ignore | ||
* Disallowed languages; included languages are ignored. | ||
@@ -319,5 +319,5 @@ * @return {Record<string, Record<string, number>>} | ||
* Languages to filter | ||
* @param {string[]} only | ||
* @param {Array<string>} only | ||
* Allowed languages; if non-empty, only included languages are kept. | ||
* @param {string[]} ignore | ||
* @param {Array<string>} ignore | ||
* Disallowed languages; included languages are ignored. | ||
@@ -348,3 +348,3 @@ * @return {boolean} | ||
* @param {string} language | ||
* @returns {TrigramTuple[]} | ||
* @returns {Array<TrigramTuple>} | ||
*/ | ||
@@ -351,0 +351,0 @@ function singleLanguageTuples(language) { |
{ | ||
"name": "franc-min", | ||
"threshold": 8000000, | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"description": "Detect the language of text", | ||
@@ -44,5 +44,3 @@ "license": "MIT", | ||
}, | ||
"scripts": { | ||
"build": "rimraf \"*.d.ts\" && tsc && type-coverage" | ||
}, | ||
"scripts": {}, | ||
"xo": false, | ||
@@ -49,0 +47,0 @@ "typeCoverage": { |
@@ -5,3 +5,3 @@ <!--This file is generated by `build.js`--> | ||
> Detect the language of text. | ||
Detect the language of text. | ||
@@ -11,9 +11,9 @@ Built with support for 82 languages (8M or more speakers). | ||
View the [monorepo](https://github.com/wooorm/franc) for more packages and | ||
usage information. | ||
info on using them. | ||
## Install | ||
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c): | ||
Node 12+ is needed to use it and it must be | ||
`import`ed instead of `require`d. | ||
This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c). | ||
In Node.js (version 14.14+, 16.0+), install with | ||
[npm](https://docs.npmjs.com/cli/install): | ||
@@ -26,3 +26,3 @@ npm: | ||
## Support | ||
## Data | ||
@@ -29,0 +29,0 @@ This build supports the following languages: |
Sorry, the diff of this file is too big to display
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
126790
802
0