mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add types for detect-character-encoding
This commit is contained in:
parent
1d74d5ac42
commit
75eafa5a64
@ -0,0 +1,10 @@
|
||||
import detectCharacterEncoding = require("detect-character-encoding");
|
||||
|
||||
const buf: Buffer = null as any;
|
||||
|
||||
const result: detectCharacterEncoding.Result | null = detectCharacterEncoding(buf);
|
||||
|
||||
if (result) {
|
||||
const str: string = result.encoding;
|
||||
const num: number = result.confidence;
|
||||
}
|
||||
17
types/detect-character-encoding/index.d.ts
vendored
Normal file
17
types/detect-character-encoding/index.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Type definitions for detect-character-encoding 0.7
|
||||
// Project: https://github.com/sonicdoe/detect-character-encoding#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
export = detectCharacterEncoding;
|
||||
|
||||
declare function detectCharacterEncoding(buf: Buffer): detectCharacterEncoding.Result | null;
|
||||
|
||||
declare namespace detectCharacterEncoding {
|
||||
interface Result {
|
||||
encoding: string;
|
||||
confidence: number;
|
||||
}
|
||||
}
|
||||
23
types/detect-character-encoding/tsconfig.json
Normal file
23
types/detect-character-encoding/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"detect-character-encoding-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/detect-character-encoding/tslint.json
Normal file
1
types/detect-character-encoding/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user