mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #28919 from wlegate/master
Adds new type definitions for 'franc'
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import detect = require('franc');
|
||||
|
||||
const testText = 'This is an example sentence';
|
||||
const testOptions = {
|
||||
minLength: 3,
|
||||
whitelist: ['eng'],
|
||||
blacklist: [],
|
||||
};
|
||||
|
||||
detect(testText);
|
||||
detect(testText, testOptions);
|
||||
|
||||
detect.all(testText);
|
||||
detect.all(testText, testOptions)[0];
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for franc 4.0
|
||||
// Project: https://github.com/wooorm/franc/
|
||||
// Definitions by: William LeGate <https://github.com/wlegate>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// ISO 639-3 code (see: https://iso639-3.sil.org/code_tables/639/data)
|
||||
type ISO6393 = string;
|
||||
|
||||
// Range [0, 1]
|
||||
type Confidence = number;
|
||||
|
||||
interface Options {
|
||||
minLength?: number;
|
||||
whitelist?: ISO6393[];
|
||||
blacklist?: ISO6393[];
|
||||
}
|
||||
|
||||
declare function detect(text: string, options?: Options): ISO6393;
|
||||
|
||||
declare namespace detect {
|
||||
function all(text: string, options?: Options): [ISO6393, number];
|
||||
}
|
||||
|
||||
export = detect;
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "franc-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -1,24 +1,16 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"freedom-tests.ts"
|
||||
],
|
||||
"files": ["index.d.ts", "freedom-tests.ts"],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user