Merge pull request #19550 from Rokt33r/wcwidth

Add wcwidth
This commit is contained in:
Nathan Shively-Sanders
2017-09-06 09:13:07 -07:00
committed by GitHub
4 changed files with 38 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for wcwidth 1.0
// Project: https://github.com/timoxley/wcwidth
// Definitions by: Junyoung Choi <https://github.com/rokt33r>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function wcwidth(input: string): number;
export = wcwidth;
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"wcwidth-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+5
View File
@@ -0,0 +1,5 @@
import wcwidth = require('wcwidth');
const length1 = wcwidth('한'); // => 2
const length2 = wcwidth('한글'); // => 4