@aws-solutions-constructs/core 2.0.0-rc.1 → 2.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/.jsii +98 -46
  2. package/index.d.ts +2 -0
  3. package/index.js +3 -1
  4. package/lib/alb-defaults.d.ts +14 -0
  5. package/lib/alb-defaults.js +24 -0
  6. package/lib/alb-helper.d.ts +21 -0
  7. package/lib/alb-helper.js +106 -0
  8. package/lib/apigateway-helper.d.ts +4 -4
  9. package/lib/apigateway-helper.js +11 -5
  10. package/lib/cloudfront-distribution-helper.d.ts +2 -2
  11. package/lib/cloudfront-distribution-helper.js +5 -5
  12. package/lib/glue-job-helper.d.ts +2 -2
  13. package/lib/glue-job-helper.js +2 -2
  14. package/lib/input-validation.d.ts +5 -0
  15. package/lib/input-validation.js +9 -2
  16. package/lib/s3-bucket-defaults.d.ts +1 -0
  17. package/lib/s3-bucket-defaults.js +11 -2
  18. package/lib/s3-bucket-helper.d.ts +1 -0
  19. package/lib/s3-bucket-helper.js +17 -2
  20. package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  21. package/node_modules/emoji-regex/README.md +73 -0
  22. package/node_modules/emoji-regex/es2015/index.js +6 -0
  23. package/node_modules/emoji-regex/es2015/text.js +6 -0
  24. package/node_modules/emoji-regex/index.d.ts +23 -0
  25. package/node_modules/emoji-regex/index.js +6 -0
  26. package/node_modules/emoji-regex/package.json +50 -0
  27. package/node_modules/emoji-regex/text.js +6 -0
  28. package/node_modules/wide-align/LICENSE +0 -0
  29. package/node_modules/wide-align/README.md +0 -0
  30. package/node_modules/wide-align/align.js +0 -0
  31. package/node_modules/wide-align/node_modules/ansi-regex/index.d.ts +37 -0
  32. package/node_modules/wide-align/node_modules/ansi-regex/index.js +4 -4
  33. package/node_modules/wide-align/node_modules/ansi-regex/package.json +53 -51
  34. package/node_modules/wide-align/node_modules/ansi-regex/readme.md +35 -3
  35. package/node_modules/wide-align/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
  36. package/node_modules/wide-align/node_modules/is-fullwidth-code-point/index.js +25 -21
  37. package/node_modules/wide-align/node_modules/is-fullwidth-code-point/license +4 -16
  38. package/node_modules/wide-align/node_modules/is-fullwidth-code-point/package.json +40 -43
  39. package/node_modules/wide-align/node_modules/is-fullwidth-code-point/readme.md +6 -6
  40. package/node_modules/wide-align/node_modules/string-width/index.d.ts +29 -0
  41. package/node_modules/wide-align/node_modules/string-width/index.js +16 -5
  42. package/node_modules/wide-align/node_modules/string-width/package.json +11 -10
  43. package/node_modules/wide-align/node_modules/string-width/readme.md +15 -7
  44. package/node_modules/wide-align/node_modules/strip-ansi/index.d.ts +17 -0
  45. package/node_modules/wide-align/node_modules/strip-ansi/index.js +1 -1
  46. package/node_modules/wide-align/node_modules/strip-ansi/package.json +52 -50
  47. package/node_modules/wide-align/node_modules/strip-ansi/readme.md +12 -5
  48. package/node_modules/wide-align/package.json +5 -5
  49. package/package.json +1 -1
  50. package/test/alb-helper.test.d.ts +13 -0
  51. package/test/alb-helper.test.js +321 -0
  52. package/test/apigateway-helper.test.js +8 -1
  53. package/test/cloudfront-distribution-s3-helper.test.js +2 -2
  54. package/test/glue-job-helper.test.js +7 -3
  55. package/test/s3-bucket.test.js +10 -1
@@ -1,53 +1,55 @@
1
1
  {
2
- "name": "ansi-regex",
3
- "version": "3.0.0",
4
- "description": "Regular expression for matching ANSI escape codes",
5
- "license": "MIT",
6
- "repository": "chalk/ansi-regex",
7
- "author": {
8
- "name": "Sindre Sorhus",
9
- "email": "sindresorhus@gmail.com",
10
- "url": "sindresorhus.com"
11
- },
12
- "engines": {
13
- "node": ">=4"
14
- },
15
- "scripts": {
16
- "test": "xo && ava",
17
- "view-supported": "node fixtures/view-codes.js"
18
- },
19
- "files": [
20
- "index.js"
21
- ],
22
- "keywords": [
23
- "ansi",
24
- "styles",
25
- "color",
26
- "colour",
27
- "colors",
28
- "terminal",
29
- "console",
30
- "cli",
31
- "string",
32
- "tty",
33
- "escape",
34
- "formatting",
35
- "rgb",
36
- "256",
37
- "shell",
38
- "xterm",
39
- "command-line",
40
- "text",
41
- "regex",
42
- "regexp",
43
- "re",
44
- "match",
45
- "test",
46
- "find",
47
- "pattern"
48
- ],
49
- "devDependencies": {
50
- "ava": "*",
51
- "xo": "*"
52
- }
2
+ "name": "ansi-regex",
3
+ "version": "5.0.1",
4
+ "description": "Regular expression for matching ANSI escape codes",
5
+ "license": "MIT",
6
+ "repository": "chalk/ansi-regex",
7
+ "author": {
8
+ "name": "Sindre Sorhus",
9
+ "email": "sindresorhus@gmail.com",
10
+ "url": "sindresorhus.com"
11
+ },
12
+ "engines": {
13
+ "node": ">=8"
14
+ },
15
+ "scripts": {
16
+ "test": "xo && ava && tsd",
17
+ "view-supported": "node fixtures/view-codes.js"
18
+ },
19
+ "files": [
20
+ "index.js",
21
+ "index.d.ts"
22
+ ],
23
+ "keywords": [
24
+ "ansi",
25
+ "styles",
26
+ "color",
27
+ "colour",
28
+ "colors",
29
+ "terminal",
30
+ "console",
31
+ "cli",
32
+ "string",
33
+ "tty",
34
+ "escape",
35
+ "formatting",
36
+ "rgb",
37
+ "256",
38
+ "shell",
39
+ "xterm",
40
+ "command-line",
41
+ "text",
42
+ "regex",
43
+ "regexp",
44
+ "re",
45
+ "match",
46
+ "test",
47
+ "find",
48
+ "pattern"
49
+ ],
50
+ "devDependencies": {
51
+ "ava": "^2.4.0",
52
+ "tsd": "^0.9.0",
53
+ "xo": "^0.25.3"
54
+ }
53
55
  }
@@ -1,4 +1,4 @@
1
- # ansi-regex [![Build Status](https://travis-ci.org/chalk/ansi-regex.svg?branch=master)](https://travis-ci.org/chalk/ansi-regex)
1
+ # ansi-regex
2
2
 
3
3
  > Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
4
4
 
@@ -23,9 +23,33 @@ ansiRegex().test('cake');
23
23
 
24
24
  '\u001B[4mcake\u001B[0m'.match(ansiRegex());
25
25
  //=> ['\u001B[4m', '\u001B[0m']
26
+
27
+ '\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
28
+ //=> ['\u001B[4m']
29
+
30
+ '\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
31
+ //=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
26
32
  ```
27
33
 
28
34
 
35
+ ## API
36
+
37
+ ### ansiRegex(options?)
38
+
39
+ Returns a regex for matching ANSI escape codes.
40
+
41
+ #### options
42
+
43
+ Type: `object`
44
+
45
+ ##### onlyFirst
46
+
47
+ Type: `boolean`<br>
48
+ Default: `false` *(Matches any ANSI escape codes in a string)*
49
+
50
+ Match only the first ANSI escape.
51
+
52
+
29
53
  ## FAQ
30
54
 
31
55
  ### Why do you test for codes not in the ECMA 48 standard?
@@ -41,6 +65,14 @@ On the historical side, those ECMA standards were established in the early 90's
41
65
  - [Josh Junon](https://github.com/qix-)
42
66
 
43
67
 
44
- ## License
68
+ ---
45
69
 
46
- MIT
70
+ <div align="center">
71
+ <b>
72
+ <a href="https://tidelift.com/subscription/pkg/npm-ansi-regex?utm_source=npm-ansi-regex&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
73
+ </b>
74
+ <br>
75
+ <sub>
76
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
77
+ </sub>
78
+ </div>
@@ -0,0 +1,17 @@
1
+ /**
2
+ Check if the character represented by a given [Unicode code point](https://en.wikipedia.org/wiki/Code_point) is [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms).
3
+
4
+ @param codePoint - The [code point](https://en.wikipedia.org/wiki/Code_point) of a character.
5
+
6
+ @example
7
+ ```
8
+ import isFullwidthCodePoint from 'is-fullwidth-code-point';
9
+
10
+ isFullwidthCodePoint('谢'.codePointAt(0));
11
+ //=> true
12
+
13
+ isFullwidthCodePoint('a'.codePointAt(0));
14
+ //=> false
15
+ ```
16
+ */
17
+ export default function isFullwidthCodePoint(codePoint: number): boolean;
@@ -1,42 +1,43 @@
1
- 'use strict';
2
1
  /* eslint-disable yoda */
3
- module.exports = x => {
4
- if (Number.isNaN(x)) {
2
+ 'use strict';
3
+
4
+ const isFullwidthCodePoint = codePoint => {
5
+ if (Number.isNaN(codePoint)) {
5
6
  return false;
6
7
  }
7
8
 
8
- // code points are derived from:
9
+ // Code points are derived from:
9
10
  // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt
10
11
  if (
11
- x >= 0x1100 && (
12
- x <= 0x115f || // Hangul Jamo
13
- x === 0x2329 || // LEFT-POINTING ANGLE BRACKET
14
- x === 0x232a || // RIGHT-POINTING ANGLE BRACKET
12
+ codePoint >= 0x1100 && (
13
+ codePoint <= 0x115F || // Hangul Jamo
14
+ codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
15
+ codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
15
16
  // CJK Radicals Supplement .. Enclosed CJK Letters and Months
16
- (0x2e80 <= x && x <= 0x3247 && x !== 0x303f) ||
17
+ (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
17
18
  // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
18
- (0x3250 <= x && x <= 0x4dbf) ||
19
+ (0x3250 <= codePoint && codePoint <= 0x4DBF) ||
19
20
  // CJK Unified Ideographs .. Yi Radicals
20
- (0x4e00 <= x && x <= 0xa4c6) ||
21
+ (0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
21
22
  // Hangul Jamo Extended-A
22
- (0xa960 <= x && x <= 0xa97c) ||
23
+ (0xA960 <= codePoint && codePoint <= 0xA97C) ||
23
24
  // Hangul Syllables
24
- (0xac00 <= x && x <= 0xd7a3) ||
25
+ (0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
25
26
  // CJK Compatibility Ideographs
26
- (0xf900 <= x && x <= 0xfaff) ||
27
+ (0xF900 <= codePoint && codePoint <= 0xFAFF) ||
27
28
  // Vertical Forms
28
- (0xfe10 <= x && x <= 0xfe19) ||
29
+ (0xFE10 <= codePoint && codePoint <= 0xFE19) ||
29
30
  // CJK Compatibility Forms .. Small Form Variants
30
- (0xfe30 <= x && x <= 0xfe6b) ||
31
+ (0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
31
32
  // Halfwidth and Fullwidth Forms
32
- (0xff01 <= x && x <= 0xff60) ||
33
- (0xffe0 <= x && x <= 0xffe6) ||
33
+ (0xFF01 <= codePoint && codePoint <= 0xFF60) ||
34
+ (0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
34
35
  // Kana Supplement
35
- (0x1b000 <= x && x <= 0x1b001) ||
36
+ (0x1B000 <= codePoint && codePoint <= 0x1B001) ||
36
37
  // Enclosed Ideographic Supplement
37
- (0x1f200 <= x && x <= 0x1f251) ||
38
+ (0x1F200 <= codePoint && codePoint <= 0x1F251) ||
38
39
  // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
39
- (0x20000 <= x && x <= 0x3fffd)
40
+ (0x20000 <= codePoint && codePoint <= 0x3FFFD)
40
41
  )
41
42
  ) {
42
43
  return true;
@@ -44,3 +45,6 @@ module.exports = x => {
44
45
 
45
46
  return false;
46
47
  };
48
+
49
+ module.exports = isFullwidthCodePoint;
50
+ module.exports.default = isFullwidthCodePoint;
@@ -1,21 +1,9 @@
1
- The MIT License (MIT)
1
+ MIT License
2
2
 
3
3
  Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11
6
 
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
8
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,45 +1,42 @@
1
1
  {
2
- "name": "is-fullwidth-code-point",
3
- "version": "2.0.0",
4
- "description": "Check if the character represented by a given Unicode code point is fullwidth",
5
- "license": "MIT",
6
- "repository": "sindresorhus/is-fullwidth-code-point",
7
- "author": {
8
- "name": "Sindre Sorhus",
9
- "email": "sindresorhus@gmail.com",
10
- "url": "sindresorhus.com"
11
- },
12
- "engines": {
13
- "node": ">=4"
14
- },
15
- "scripts": {
16
- "test": "xo && ava"
17
- },
18
- "files": [
19
- "index.js"
20
- ],
21
- "keywords": [
22
- "fullwidth",
23
- "full-width",
24
- "full",
25
- "width",
26
- "unicode",
27
- "character",
28
- "char",
29
- "string",
30
- "str",
31
- "codepoint",
32
- "code",
33
- "point",
34
- "is",
35
- "detect",
36
- "check"
37
- ],
38
- "devDependencies": {
39
- "ava": "*",
40
- "xo": "*"
41
- },
42
- "xo": {
43
- "esnext": true
44
- }
2
+ "name": "is-fullwidth-code-point",
3
+ "version": "3.0.0",
4
+ "description": "Check if the character represented by a given Unicode code point is fullwidth",
5
+ "license": "MIT",
6
+ "repository": "sindresorhus/is-fullwidth-code-point",
7
+ "author": {
8
+ "name": "Sindre Sorhus",
9
+ "email": "sindresorhus@gmail.com",
10
+ "url": "sindresorhus.com"
11
+ },
12
+ "engines": {
13
+ "node": ">=8"
14
+ },
15
+ "scripts": {
16
+ "test": "xo && ava && tsd-check"
17
+ },
18
+ "files": [
19
+ "index.js",
20
+ "index.d.ts"
21
+ ],
22
+ "keywords": [
23
+ "fullwidth",
24
+ "full-width",
25
+ "full",
26
+ "width",
27
+ "unicode",
28
+ "character",
29
+ "string",
30
+ "codepoint",
31
+ "code",
32
+ "point",
33
+ "is",
34
+ "detect",
35
+ "check"
36
+ ],
37
+ "devDependencies": {
38
+ "ava": "^1.3.1",
39
+ "tsd-check": "^0.5.0",
40
+ "xo": "^0.24.0"
41
+ }
45
42
  }
@@ -6,7 +6,7 @@
6
6
  ## Install
7
7
 
8
8
  ```
9
- $ npm install --save is-fullwidth-code-point
9
+ $ npm install is-fullwidth-code-point
10
10
  ```
11
11
 
12
12
 
@@ -15,23 +15,23 @@ $ npm install --save is-fullwidth-code-point
15
15
  ```js
16
16
  const isFullwidthCodePoint = require('is-fullwidth-code-point');
17
17
 
18
- isFullwidthCodePoint('谢'.codePointAt());
18
+ isFullwidthCodePoint('谢'.codePointAt(0));
19
19
  //=> true
20
20
 
21
- isFullwidthCodePoint('a'.codePointAt());
21
+ isFullwidthCodePoint('a'.codePointAt(0));
22
22
  //=> false
23
23
  ```
24
24
 
25
25
 
26
26
  ## API
27
27
 
28
- ### isFullwidthCodePoint(input)
28
+ ### isFullwidthCodePoint(codePoint)
29
29
 
30
- #### input
30
+ #### codePoint
31
31
 
32
32
  Type: `number`
33
33
 
34
- [Code point](https://en.wikipedia.org/wiki/Code_point) of a character.
34
+ The [code point](https://en.wikipedia.org/wiki/Code_point) of a character.
35
35
 
36
36
 
37
37
  ## License
@@ -0,0 +1,29 @@
1
+ declare const stringWidth: {
2
+ /**
3
+ Get the visual width of a string - the number of columns required to display it.
4
+
5
+ Some Unicode characters are [fullwidth](https://en.wikipedia.org/wiki/Halfwidth_and_fullwidth_forms) and use double the normal width. [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) are stripped and doesn't affect the width.
6
+
7
+ @example
8
+ ```
9
+ import stringWidth = require('string-width');
10
+
11
+ stringWidth('a');
12
+ //=> 1
13
+
14
+ stringWidth('古');
15
+ //=> 2
16
+
17
+ stringWidth('\u001B[1m古\u001B[22m');
18
+ //=> 2
19
+ ```
20
+ */
21
+ (string: string): number;
22
+
23
+ // TODO: remove this in the next major version, refactor the whole definition to:
24
+ // declare function stringWidth(string: string): number;
25
+ // export = stringWidth;
26
+ default: typeof stringWidth;
27
+ }
28
+
29
+ export = stringWidth;
@@ -1,18 +1,25 @@
1
1
  'use strict';
2
2
  const stripAnsi = require('strip-ansi');
3
3
  const isFullwidthCodePoint = require('is-fullwidth-code-point');
4
+ const emojiRegex = require('emoji-regex');
4
5
 
5
- module.exports = str => {
6
- if (typeof str !== 'string' || str.length === 0) {
6
+ const stringWidth = string => {
7
+ if (typeof string !== 'string' || string.length === 0) {
7
8
  return 0;
8
9
  }
9
10
 
10
- str = stripAnsi(str);
11
+ string = stripAnsi(string);
12
+
13
+ if (string.length === 0) {
14
+ return 0;
15
+ }
16
+
17
+ string = string.replace(emojiRegex(), ' ');
11
18
 
12
19
  let width = 0;
13
20
 
14
- for (let i = 0; i < str.length; i++) {
15
- const code = str.codePointAt(i);
21
+ for (let i = 0; i < string.length; i++) {
22
+ const code = string.codePointAt(i);
16
23
 
17
24
  // Ignore control characters
18
25
  if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) {
@@ -34,3 +41,7 @@ module.exports = str => {
34
41
 
35
42
  return width;
36
43
  };
44
+
45
+ module.exports = stringWidth;
46
+ // TODO: remove this in the next major version
47
+ module.exports.default = stringWidth;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "string-width",
3
- "version": "2.1.1",
3
+ "version": "4.2.3",
4
4
  "description": "Get the visual width of a string - the number of columns required to display it",
5
5
  "license": "MIT",
6
6
  "repository": "sindresorhus/string-width",
@@ -10,19 +10,18 @@
10
10
  "url": "sindresorhus.com"
11
11
  },
12
12
  "engines": {
13
- "node": ">=4"
13
+ "node": ">=8"
14
14
  },
15
15
  "scripts": {
16
- "test": "xo && ava"
16
+ "test": "xo && ava && tsd"
17
17
  },
18
18
  "files": [
19
- "index.js"
19
+ "index.js",
20
+ "index.d.ts"
20
21
  ],
21
22
  "keywords": [
22
23
  "string",
23
- "str",
24
24
  "character",
25
- "char",
26
25
  "unicode",
27
26
  "width",
28
27
  "visual",
@@ -45,11 +44,13 @@
45
44
  "fixed-width"
46
45
  ],
47
46
  "dependencies": {
48
- "is-fullwidth-code-point": "^2.0.0",
49
- "strip-ansi": "^4.0.0"
47
+ "emoji-regex": "^8.0.0",
48
+ "is-fullwidth-code-point": "^3.0.0",
49
+ "strip-ansi": "^6.0.1"
50
50
  },
51
51
  "devDependencies": {
52
- "ava": "*",
53
- "xo": "*"
52
+ "ava": "^1.4.1",
53
+ "tsd": "^0.7.1",
54
+ "xo": "^0.24.0"
54
55
  }
55
56
  }
@@ -1,4 +1,4 @@
1
- # string-width [![Build Status](https://travis-ci.org/sindresorhus/string-width.svg?branch=master)](https://travis-ci.org/sindresorhus/string-width)
1
+ # string-width
2
2
 
3
3
  > Get the visual width of a string - the number of columns required to display it
4
4
 
@@ -19,14 +19,14 @@ $ npm install string-width
19
19
  ```js
20
20
  const stringWidth = require('string-width');
21
21
 
22
+ stringWidth('a');
23
+ //=> 1
24
+
22
25
  stringWidth('古');
23
26
  //=> 2
24
27
 
25
- stringWidth('\u001b[1m古\u001b[22m');
28
+ stringWidth('\u001B[1m古\u001B[22m');
26
29
  //=> 2
27
-
28
- stringWidth('a');
29
- //=> 1
30
30
  ```
31
31
 
32
32
 
@@ -37,6 +37,14 @@ stringWidth('a');
37
37
  - [widest-line](https://github.com/sindresorhus/widest-line) - Get the visual width of the widest line in a string
38
38
 
39
39
 
40
- ## License
40
+ ---
41
41
 
42
- MIT © [Sindre Sorhus](https://sindresorhus.com)
42
+ <div align="center">
43
+ <b>
44
+ <a href="https://tidelift.com/subscription/pkg/npm-string-width?utm_source=npm-string-width&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
45
+ </b>
46
+ <br>
47
+ <sub>
48
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
49
+ </sub>
50
+ </div>
@@ -0,0 +1,17 @@
1
+ /**
2
+ Strip [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code) from a string.
3
+
4
+ @example
5
+ ```
6
+ import stripAnsi = require('strip-ansi');
7
+
8
+ stripAnsi('\u001B[4mUnicorn\u001B[0m');
9
+ //=> 'Unicorn'
10
+
11
+ stripAnsi('\u001B]8;;https://github.com\u0007Click\u001B]8;;\u0007');
12
+ //=> 'Click'
13
+ ```
14
+ */
15
+ declare function stripAnsi(string: string): string;
16
+
17
+ export = stripAnsi;
@@ -1,4 +1,4 @@
1
1
  'use strict';
2
2
  const ansiRegex = require('ansi-regex');
3
3
 
4
- module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input;
4
+ module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string;