Merge pull request #28919 from wlegate/master

Adds new type definitions for 'franc'
This commit is contained in:
Nathan Shively-Sanders
2018-09-18 11:02:50 -07:00
committed by GitHub
5 changed files with 59 additions and 12 deletions
+14
View File
@@ -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];
+24
View File
@@ -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;
+16
View File
@@ -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"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+4 -12
View File
@@ -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
}
}
}