mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 20:39:17 +08:00
add types of pangu (#22643)
* add types of pangu * remove default export and unused namespace
This commit is contained in:
21
types/pangu/index.d.ts
vendored
Normal file
21
types/pangu/index.d.ts
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
// Type definitions for pangu 3.3
|
||||
// Project: https://github.com/vinta/pangu.js
|
||||
// Definitions by: York Yao <https://github.com/plantain-00>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function spacing(text: string): string;
|
||||
|
||||
export function spacingFile(path: string, callback: (error: Error, data: string) => void): void;
|
||||
export function spacingFile(path: string): Promise<string>;
|
||||
|
||||
export function spacingFileSync(path: string): string;
|
||||
|
||||
export function spacingText(text: string, callback: (error: Error, data: string) => void): void;
|
||||
export function spacingText(text: string): Promise<string>;
|
||||
|
||||
export function spacingPage(): void;
|
||||
export function spacingElementById(id: string): void;
|
||||
export function spacingElementByClassName(className: string): void;
|
||||
export function spacingElementByTagName(tagName: string): void;
|
||||
|
||||
export as namespace pangu;
|
||||
17
types/pangu/pangu-tests.ts
Normal file
17
types/pangu/pangu-tests.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import pangu = require('pangu');
|
||||
|
||||
pangu.spacing('Sephiroth見他這等神情,也是悚然一驚:不知我這Ultimate Destructive Magic是否對付得了?');
|
||||
// output: Sephiroth 見他這等神情, 也是悚然一驚: 不知我這 Ultimate Destructive Magic 是否對付得了?
|
||||
|
||||
pangu.spacingFile('/path/to/text.txt', (err, data) => {
|
||||
});
|
||||
|
||||
pangu.spacingFile('/path/to/text.txt').then(data => {
|
||||
});
|
||||
|
||||
const data = pangu.spacingFileSync('/path/to/text.txt');
|
||||
|
||||
pangu.spacingPage();
|
||||
pangu.spacingElementById('main');
|
||||
pangu.spacingElementByClassName('comment');
|
||||
pangu.spacingElementByTagName('p');
|
||||
23
types/pangu/tsconfig.json
Normal file
23
types/pangu/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",
|
||||
"pangu-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/pangu/tslint.json
Normal file
1
types/pangu/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user