console-table-printer 2.12.0 → 2.12.1

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.
@@ -5,22 +5,26 @@ const console_utils_1 = require("./console-utils");
5
5
  // ("How are you?",10) => ["How are ", "you?"]
6
6
  const splitTextIntoTextsOfMinLen = (inpStr, width, charLength) => {
7
7
  const ret = [];
8
- const spaceSeparatedStrings = inpStr.split(' ');
9
- let now = [];
10
- let cnt = 0;
11
- spaceSeparatedStrings.forEach((strWithoutSpace) => {
12
- const consoleWidth = (0, console_utils_1.findWidthInConsole)(strWithoutSpace, charLength);
13
- if (cnt + consoleWidth <= width) {
14
- cnt += consoleWidth + 1; // 1 for the space
15
- now.push(strWithoutSpace);
16
- }
17
- else {
18
- ret.push(now.join(' '));
19
- now = [strWithoutSpace];
20
- cnt = consoleWidth + 1;
21
- }
8
+ const lines = inpStr.split(/[\n\r]/);
9
+ lines.forEach((line) => {
10
+ const spaceSeparatedStrings = line.split(' ');
11
+ let now = [];
12
+ let cnt = 0;
13
+ spaceSeparatedStrings.forEach((strWithoutSpace) => {
14
+ const consoleWidth = (0, console_utils_1.findWidthInConsole)(strWithoutSpace, charLength);
15
+ if (cnt + consoleWidth <= width) {
16
+ cnt += consoleWidth + 1; // 1 for the space
17
+ now.push(strWithoutSpace);
18
+ }
19
+ else {
20
+ if (now.length > 0)
21
+ ret.push(now.join(' '));
22
+ now = [strWithoutSpace];
23
+ cnt = consoleWidth + 1;
24
+ }
25
+ });
26
+ ret.push(now.join(' '));
22
27
  });
23
- ret.push(now.join(' '));
24
28
  return ret;
25
29
  };
26
30
  exports.splitTextIntoTextsOfMinLen = splitTextIntoTextsOfMinLen;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "console-table-printer",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "repository": "github:ayonious/console-table-printer",
5
5
  "description": "Printing pretty tables on console log",
6
6
  "main": "dist/index.js",
@@ -27,21 +27,21 @@
27
27
  "devDependencies": {
28
28
  "@semantic-release/changelog": "^6.0.3",
29
29
  "@semantic-release/git": "^10.0.1",
30
- "@types/jest": "^29.5.11",
31
- "@typescript-eslint/eslint-plugin": "^6.15.0",
32
- "@typescript-eslint/parser": "^6.15.0",
33
- "eslint": "^8.56.0",
30
+ "@types/jest": "^29.5.12",
31
+ "@typescript-eslint/eslint-plugin": "^7.13.1",
32
+ "@typescript-eslint/parser": "^7.13.1",
33
+ "eslint": "^9.5.0",
34
34
  "eslint-config-airbnb-base": "^15.0.0",
35
35
  "eslint-config-prettier": "^9.1.0",
36
36
  "eslint-plugin-import": "^2.29.1",
37
- "eslint-plugin-prettier": "^5.1.0",
38
- "husky": "^8.0.3",
37
+ "eslint-plugin-prettier": "^5.1.3",
38
+ "husky": "^9.0.11",
39
39
  "jest": "^29.7.0",
40
- "prettier": "^3.1.1",
41
- "pretty-quick": "^3.1.3",
42
- "semantic-release": "^22.0.12",
43
- "ts-jest": "^29.1.1",
44
- "typescript": "^5.3.3"
40
+ "prettier": "^3.3.2",
41
+ "pretty-quick": "^4.0.0",
42
+ "semantic-release": "^24.0.0",
43
+ "ts-jest": "^29.1.5",
44
+ "typescript": "^5.4.5"
45
45
  },
46
46
  "homepage": "https://console-table.netlify.app",
47
47
  "dependencies": {