fast-chunk-string: initial definition (#40207)

This commit is contained in:
Junxiao Shi
2019-11-07 10:25:58 -08:00
committed by Nathan Shively-Sanders
parent acdd3d40c6
commit 7221daab35
4 changed files with 56 additions and 0 deletions
@@ -0,0 +1,19 @@
import fastChunkString = require("fast-chunk-string");
// $ExpectType string[]
fastChunkString("AABBCC", { size: 2 });
// $ExpectType string[]
fastChunkString("😀😃😄😁", { size: 2, unicodeAware: false });
// $ExpectType string[]
fastChunkString("😀😃😄😁", { size: 2, unicodeAware: true });
// $ExpectError
fastChunkString("missing options");
// $ExpectError
fastChunkString("missing size", { unicodeAware: false });
// $ExpectError
fastChunkString(null, { size: 2 });
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for fast-chunk-string 1.0
// Project: https://github.com/vladgolubev/fast-chunk-string#readme
// Definitions by: Junxiao Shi <https://github.com/yoursunny>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Options {
size: number;
unicodeAware?: boolean;
}
declare function fastChunkString(str: string, options: Options): string[];
export = fastChunkString;
+23
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",
"fast-chunk-string-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }