Add definitions for 'fold-to-ascii' (#47612)

Co-authored-by: Morgan Zolob <morgan.zolob@ingrooves.com>
This commit is contained in:
Morgan Zolob 2020-09-16 16:41:13 -07:00 committed by GitHub
parent 9b7f2b419e
commit d51a678069
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,5 @@
import * as ASCIIFolder from 'fold-to-ascii';
ASCIIFolder.foldReplacing('Lörem 🤧 ëripuît'); // $ExpectType string
ASCIIFolder.foldReplacing('Lörem 🤧 ëripuît', 'X'); // $ExpectType string
ASCIIFolder.foldMaintaining('Lörem 🤧 ëripuît'); // $ExpectType string

22
types/fold-to-ascii/index.d.ts vendored Normal file
View File

@ -0,0 +1,22 @@
// Type definitions for fold-to-ascii 5.0
// Project: https://github.com/mplatt/fold-to-ascii
// Definitions by: Morgan Zolob <https://github.com/mogzol>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Replace all known non-ASCII characters with appropriate replacements,
* replace the unknown ones with a fallback
*
* @param str Input string containing ASCII and/or non-ASCII characters
* @param replacement Fallback for unknown characters in the input string
* (defaults to empty string)
*/
export function foldReplacing(str?: string, replacement?: string): string;
/**
* Replace all known non-ASCII characters with appropriate replacements,
* maintain the unknown ones
*
* @param str Input string containing ASCII and/or non-ASCII characters
*/
export function foldMaintaining(str?: string): string;

View File

@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"fold-to-ascii-tests.ts"
]
}

View File

@ -0,0 +1,4 @@
{
"extends": "dtslint/dt.json",
"rules": { "npm-naming": [true, { "mode": "code", "errors": [["NeedsExportEquals", false]] }] }
}