@thi.ng/strings 3.7.31 → 3.7.33

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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-04-20T14:42:45Z
3
+ - **Last updated**: 2024-05-08T18:24:31Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
package/README.md CHANGED
@@ -151,7 +151,7 @@ For Node.js REPL:
151
151
  const str = await import("@thi.ng/strings");
152
152
  ```
153
153
 
154
- Package sizes (brotli'd, pre-treeshake): ESM: 5.42 KB
154
+ Package sizes (brotli'd, pre-treeshake): ESM: 5.43 KB
155
155
 
156
156
  ## Dependencies
157
157
 
package/center.js CHANGED
@@ -5,8 +5,7 @@ const center = memoizeJ(
5
5
  (n, pad = " ") => {
6
6
  const buf = repeat(String(pad), n);
7
7
  return (x) => {
8
- if (x == null)
9
- return buf;
8
+ if (x == null) return buf;
10
9
  x = x.toString();
11
10
  const r = (n - x.length) / 2;
12
11
  return x.length < n ? buf.substring(0, r) + x + buf.substring(
package/cursor.js CHANGED
@@ -1,13 +1,11 @@
1
1
  const computeCursorPos = (str, pos, delim = "\n", offset = [1, 1]) => {
2
- if (!str.length)
3
- return [1, 1];
2
+ if (!str.length) return [1, 1];
4
3
  pos = Math.min(Math.max(0, pos), str.length);
5
4
  const lines = str.split(delim);
6
5
  const n = lines.length;
7
6
  for (let i = 0; i < n; i++) {
8
7
  const l = lines[i];
9
- if (pos <= l.length)
10
- return [i + offset[0], pos + offset[1]];
8
+ if (pos <= l.length) return [i + offset[0], pos + offset[1]];
11
9
  pos -= l.length + 1;
12
10
  }
13
11
  return [n + offset[0] - 1, offset[1]];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/strings",
3
- "version": "3.7.31",
3
+ "version": "3.7.33",
4
4
  "description": "Various string formatting & utility functions",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -27,7 +27,7 @@
27
27
  "build": "yarn build:esbuild && yarn build:decl",
28
28
  "build:decl": "tsc --declaration --emitDeclarationOnly",
29
29
  "build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
30
- "clean": "rimraf --glob '*.js' '*.d.ts' '*.map' doc",
30
+ "clean": "bun ../../tools/src/clean-package.ts",
31
31
  "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
32
32
  "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
33
33
  "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
@@ -36,17 +36,16 @@
36
36
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.11.0",
40
- "@thi.ng/errors": "^2.5.5",
41
- "@thi.ng/hex": "^2.3.44",
42
- "@thi.ng/memoize": "^3.3.2"
39
+ "@thi.ng/api": "^8.11.2",
40
+ "@thi.ng/errors": "^2.5.7",
41
+ "@thi.ng/hex": "^2.3.46",
42
+ "@thi.ng/memoize": "^3.3.4"
43
43
  },
44
44
  "devDependencies": {
45
- "@microsoft/api-extractor": "^7.43.0",
46
- "esbuild": "^0.20.2",
47
- "rimraf": "^5.0.5",
48
- "typedoc": "^0.25.12",
49
- "typescript": "^5.4.3"
45
+ "@microsoft/api-extractor": "^7.43.2",
46
+ "esbuild": "^0.21.1",
47
+ "typedoc": "^0.25.13",
48
+ "typescript": "^5.4.5"
50
49
  },
51
50
  "keywords": [
52
51
  "ansi",
@@ -204,5 +203,5 @@
204
203
  "thi.ng": {
205
204
  "year": 2015
206
205
  },
207
- "gitHead": "8339d05ecc857e529c7325a9839c0063b89e728d\n"
206
+ "gitHead": "df34b4a9e650cc7323575356de207d78933bdcf3\n"
208
207
  }
package/pad-left.js CHANGED
@@ -3,8 +3,7 @@ import { repeat } from "./repeat.js";
3
3
  const padLeft = memoizeJ((n, ch = " ") => {
4
4
  const buf = repeat(String(ch), n);
5
5
  return (x, len) => {
6
- if (x == null)
7
- return buf;
6
+ if (x == null) return buf;
8
7
  x = x.toString();
9
8
  len = len !== void 0 ? len : x.length;
10
9
  return len < n ? buf.substring(len) + x : x;
package/pad-right.js CHANGED
@@ -3,8 +3,7 @@ import { repeat } from "./repeat.js";
3
3
  const padRight = memoizeJ((n, ch = " ") => {
4
4
  const buf = repeat(String(ch), n);
5
5
  return (x, len) => {
6
- if (x == null)
7
- return buf;
6
+ if (x == null) return buf;
8
7
  x = x.toString();
9
8
  len = len !== void 0 ? len : x.length;
10
9
  return len < n ? x + buf.substring(len) : x;
package/utf8.js CHANGED
@@ -27,8 +27,7 @@ const utf8Decode = (buf, start, num) => {
27
27
  c = (c & 15) << 12 | (buf[i++] & 63) << 6 | buf[i++] & 63;
28
28
  } else if (c >= 240 && c < 248) {
29
29
  c = (c & 7) << 18 | (buf[i++] & 63) << 12 | (buf[i++] & 63) << 6 | buf[i++] & 63;
30
- } else
31
- utf8Error();
30
+ } else utf8Error();
32
31
  result += fromUtf8CodePoint(c);
33
32
  }
34
33
  }
@@ -51,8 +50,7 @@ const utf8Encode = (src, capacity) => {
51
50
  c = 65536 + ((c & 1023) << 10) + (src.charCodeAt(++i) & 1023);
52
51
  buf[pos++] = 240 | c >> 18;
53
52
  buf[pos++] = 128 | c >> 12 & 63;
54
- } else
55
- buf[pos++] = 224 | c >> 12;
53
+ } else buf[pos++] = 224 | c >> 12;
56
54
  buf[pos++] = 128 | c >> 6 & 63;
57
55
  }
58
56
  buf[pos++] = 128 | c & 63;
@@ -61,8 +59,7 @@ const utf8Encode = (src, capacity) => {
61
59
  return buf.subarray(0, pos);
62
60
  };
63
61
  const fromUtf8CodePoint = (x) => {
64
- if (x < 65536)
65
- return String.fromCharCode(x);
62
+ if (x < 65536) return String.fromCharCode(x);
66
63
  if (x < 1114112) {
67
64
  x -= 65536;
68
65
  return String.fromCharCode(55296 | x >>> 10, 56320 | x & 1023);
package/word-wrap.js CHANGED
@@ -26,8 +26,7 @@ const SPLIT_ANSI = {
26
26
  let i = max;
27
27
  let match;
28
28
  while (match = re.exec(x)) {
29
- if (match.index >= max)
30
- break;
29
+ if (match.index >= max) break;
31
30
  const n = match[0].length;
32
31
  i += n;
33
32
  max += n;