Socket
Socket
Sign inDemoInstall

@thi.ng/strings

Package Overview
Dependencies
4
Maintainers
1
Versions
181
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.7.30 to 3.7.31

25

center.js
import { memoizeJ } from "@thi.ng/memoize/memoizej";
import { repeat } from "./repeat.js";
import { truncate } from "./truncate.js";
const center = memoizeJ((n, pad = " ") => {
const buf = repeat(String(pad), n);
return (x) => {
if (x == null)
return buf;
x = x.toString();
const r = (n - x.length) / 2;
return x.length < n ? buf.substring(0, r) + x + buf.substring(0, r + ((n & 1) === (x.length & 1) ? 0 : 1)) : truncate(n)(x);
};
});
const center = memoizeJ(
(n, pad = " ") => {
const buf = repeat(String(pad), n);
return (x) => {
if (x == null)
return buf;
x = x.toString();
const r = (n - x.length) / 2;
return x.length < n ? buf.substring(0, r) + x + buf.substring(
0,
r + ((n & 1) === (x.length & 1) ? 0 : 1)
) : truncate(n)(x);
};
}
);
export {
center
};

8

CHANGELOG.md
# Change Log
- **Last updated**: 2024-04-11T12:32:44Z
- **Last updated**: 2024-04-20T14:42:45Z
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)

@@ -12,2 +12,8 @@

### [3.7.31](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.7.31) (2024-04-20)
#### ♻️ Refactoring
- update type usage ([4664361](https://github.com/thi-ng/umbrella/commit/4664361))
### [3.7.28](https://github.com/thi-ng/umbrella/tree/@thi.ng/strings@3.7.28) (2024-03-27)

@@ -14,0 +20,0 @@

{
"name": "@thi.ng/strings",
"version": "3.7.30",
"version": "3.7.31",
"description": "Various string formatting & utility functions",

@@ -39,6 +39,6 @@ "type": "module",

"dependencies": {
"@thi.ng/api": "^8.10.1",
"@thi.ng/errors": "^2.5.4",
"@thi.ng/hex": "^2.3.43",
"@thi.ng/memoize": "^3.3.1"
"@thi.ng/api": "^8.11.0",
"@thi.ng/errors": "^2.5.5",
"@thi.ng/hex": "^2.3.44",
"@thi.ng/memoize": "^3.3.2"
},

@@ -208,3 +208,3 @@ "devDependencies": {

},
"gitHead": "18a0c063a7b33d790e5bc2486c106f45f663ac28\n"
"gitHead": "8339d05ecc857e529c7325a9839c0063b89e728d\n"
}

@@ -143,6 +143,6 @@ <!-- This file is generated - DO NOT EDIT! -->

```html
<script type="module" src="https://cdn.skypack.dev/@thi.ng/strings"></script>
<script type="module" src="https://esm.run/@thi.ng/strings"></script>
```
[Skypack documentation](https://docs.skypack.dev/)
[JSDelivr documentation](https://www.jsdelivr.com/)

@@ -149,0 +149,0 @@ For Node.js REPL:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc