@thi.ng/strings 3.7.29 → 3.7.31

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-08T14:59:30Z
3
+ - **Last updated**: 2024-04-20T14:42:45Z
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.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [3.7.31](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.7.31) (2024-04-20)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - update type usage ([4664361](https://github.com/thi-ng/umbrella/commit/4664361))
17
+
12
18
  ### [3.7.28](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.7.28) (2024-03-27)
13
19
 
14
20
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  [![Mastodon Follow](https://img.shields.io/mastodon/follow/109331703950160316?domain=https%3A%2F%2Fmastodon.thi.ng&style=social)](https://mastodon.thi.ng/@toxi)
8
8
 
9
9
  > [!NOTE]
10
- > This is one of 191 standalone projects, maintained as part
10
+ > This is one of 192 standalone projects, maintained as part
11
11
  > of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
12
12
  > and anti-framework.
13
13
  >
@@ -140,10 +140,10 @@ import * as str from "@thi.ng/strings";
140
140
  Browser ESM import:
141
141
 
142
142
  ```html
143
- <script type="module" src="https://cdn.skypack.dev/@thi.ng/strings"></script>
143
+ <script type="module" src="https://esm.run/@thi.ng/strings"></script>
144
144
  ```
145
145
 
146
- [Skypack documentation](https://docs.skypack.dev/)
146
+ [JSDelivr documentation](https://www.jsdelivr.com/)
147
147
 
148
148
  For Node.js REPL:
149
149
 
package/center.js CHANGED
@@ -1,16 +1,21 @@
1
1
  import { memoizeJ } from "@thi.ng/memoize/memoizej";
2
2
  import { repeat } from "./repeat.js";
3
3
  import { truncate } from "./truncate.js";
4
- const center = memoizeJ((n, pad = " ") => {
5
- const buf = repeat(String(pad), n);
6
- return (x) => {
7
- if (x == null)
8
- return buf;
9
- x = x.toString();
10
- const r = (n - x.length) / 2;
11
- return x.length < n ? buf.substring(0, r) + x + buf.substring(0, r + ((n & 1) === (x.length & 1) ? 0 : 1)) : truncate(n)(x);
12
- };
13
- });
4
+ const center = memoizeJ(
5
+ (n, pad = " ") => {
6
+ const buf = repeat(String(pad), n);
7
+ return (x) => {
8
+ if (x == null)
9
+ return buf;
10
+ x = x.toString();
11
+ const r = (n - x.length) / 2;
12
+ return x.length < n ? buf.substring(0, r) + x + buf.substring(
13
+ 0,
14
+ r + ((n & 1) === (x.length & 1) ? 0 : 1)
15
+ ) : truncate(n)(x);
16
+ };
17
+ }
18
+ );
14
19
  export {
15
20
  center
16
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/strings",
3
- "version": "3.7.29",
3
+ "version": "3.7.31",
4
4
  "description": "Various string formatting & utility functions",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -36,10 +36,10 @@
36
36
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.10.0",
40
- "@thi.ng/errors": "^2.5.3",
41
- "@thi.ng/hex": "^2.3.42",
42
- "@thi.ng/memoize": "^3.3.0"
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"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@microsoft/api-extractor": "^7.43.0",
@@ -204,5 +204,5 @@
204
204
  "thi.ng": {
205
205
  "year": 2015
206
206
  },
207
- "gitHead": "85ac4bd4d6d89f8e3689e2863d5bea0cecdb371c\n"
207
+ "gitHead": "8339d05ecc857e529c7325a9839c0063b89e728d\n"
208
208
  }