@visulima/string 2.0.0 → 2.0.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.
- package/CHANGELOG.md +26 -0
- package/dist/truncate.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
## @visulima/string [2.0.2](https://github.com/visulima/visulima/compare/@visulima/string@2.0.1...@visulima/string@2.0.2) (2025-10-22)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **string/truncate:** don't replace single-character strings with the ellipsis ([#559](https://github.com/visulima/visulima/issues/559)) ([91f185d](https://github.com/visulima/visulima/commit/91f185d669240986da883035e59432050058272e))
|
|
6
|
+
|
|
7
|
+
### Miscellaneous Chores
|
|
8
|
+
|
|
9
|
+
* update package dependencies and configurations ([7bfe7e7](https://github.com/visulima/visulima/commit/7bfe7e71869580900aab50efb064b4293994ed9a))
|
|
10
|
+
|
|
11
|
+
## @visulima/string [2.0.1](https://github.com/visulima/visulima/compare/@visulima/string@2.0.0...@visulima/string@2.0.1) (2025-10-21)
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* allow node v25 and updated dev deps ([8158cc5](https://github.com/visulima/visulima/commit/8158cc53ec92bd0331e8c6bd0fcbc8ab61b9320f))
|
|
16
|
+
|
|
17
|
+
### Miscellaneous Chores
|
|
18
|
+
|
|
19
|
+
* **deps:** update package versions and dependencies ([88d8d32](https://github.com/visulima/visulima/commit/88d8d32c4629a7a06c8770369191da2cc81087cc))
|
|
20
|
+
* update package dependencies across multiple packages ([17e3f23](https://github.com/visulima/visulima/commit/17e3f2377c8a3f98e2eed2192c5adaf6e32558b5))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Dependencies
|
|
24
|
+
|
|
25
|
+
* **@visulima/colorize:** upgraded to 1.4.25
|
|
26
|
+
|
|
1
27
|
## @visulima/string [2.0.0](https://github.com/visulima/visulima/compare/@visulima/string@1.5.2...@visulima/string@2.0.0) (2025-10-15)
|
|
2
28
|
|
|
3
29
|
### ⚠ BREAKING CHANGES
|
package/dist/truncate.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var g=Object.defineProperty;var
|
|
1
|
+
var g=Object.defineProperty;var l=(t,i)=>g(t,"name",{value:i,configurable:!0});import{getStringTruncatedWidth as p}from"./get-string-truncated-width.js";import{slice as d}from"./slice.js";var b=Object.defineProperty,f=l((t,i)=>b(t,"name",{value:i,configurable:!0}),"h");const u="…",y=3,h=f((t,i,e=!1)=>{if(t.charAt(i)===" ")return i;const r=e?1:-1,c=Math.min(y,e?t.length-i:i);for(let a=1;a<=c;a++){const n=i+a*r;if(t.charAt(n)===" ")return n}return i},"findNearestSpace"),T=f((t,i,e={})=>{if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a string, got ${typeof t}`);if(typeof i!="number")throw new TypeError(`Expected \`limit\` to be a number, got ${typeof i}`);if(t===""||i<=0)return"";t=t.normalize("NFC");const{ellipsis:r=u,position:c="end",preferTruncationOnSpace:a=!1}=e;let n=e.ellipsisWidth??r===u?1:void 0;n===void 0&&(n=p(r,{...e.width,ellipsis:"",ellipsisWidth:0,limit:Number.POSITIVE_INFINITY}).width);const{width:o}=p(t,{...e.width,ellipsis:r,ellipsisWidth:n});if(o<=i)return t;switch(c){case"end":{if(a){const s=h(t,i-1);return d(t,0,s,{width:e.width})+r}return d(t,0,i-n,{width:e.width})+r}case"middle":{const s=Math.floor(i/2);if(a){const w=h(t,s),m=h(t,o-(i-s)+1,!0);return d(t,0,w)+r+d(t,m,o).trim()}return d(t,0,s,{width:e.width})+r+d(t,o-(i-s)+n,o,{width:e.width})}case"start":{if(a){const s=h(t,o-i+1,!0);return r+d(t,s,o).trim()}return r+d(t,o-i+n,o,{width:e.width})}default:throw new Error(`Invalid position: expected 'start', 'middle' or 'end', got '${c}'`)}},"truncate");export{T as truncate};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visulima/string",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Functions for manipulating strings.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"visulima",
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
"CHANGELOG.md"
|
|
229
229
|
],
|
|
230
230
|
"engines": {
|
|
231
|
-
"node": ">=20.19 <=
|
|
231
|
+
"node": ">=20.19 <=25.x"
|
|
232
232
|
},
|
|
233
233
|
"publishConfig": {
|
|
234
234
|
"access": "public",
|