@stacksjs/strings 0.75.447 → 0.75.451

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/README.md CHANGED
@@ -135,3 +135,7 @@ Many thanks to the following core technologies & people who have contributed to
135
135
  The MIT License (MIT). Please see [LICENSE](https://github.com/stacksjs/stacks/tree/main/LICENSE.md) for more information.
136
136
 
137
137
  Made with 💙
138
+
139
+ `mask(value, character, index, length?)` counts Unicode code points. Index and
140
+ explicit length must be safe integers, otherwise it throws RangeError. Negative
141
+ indices count from the end; negative integer lengths mask nothing.
package/dist/helpers.js CHANGED
@@ -1 +1 @@
1
- export function toString(v){return Object.prototype.toString.call(v)}export function mask(value,character,index,length){if(character==="")return value;const chars=Array.from(value),len=chars.length,start=index<0?Math.max(0,len+index):index;if(start>=len)return value;const maskLen=length===void 0?len-start:Math.max(0,length);if(maskLen===0)return value;const end=Math.min(len,start+maskLen),fill=(Array.from(character)[0]??"").repeat(end-start);return chars.slice(0,start).join("")+fill+chars.slice(end).join("")}
1
+ export function toString(v){return Object.prototype.toString.call(v)}export function mask(value,character,index,length){if(!Number.isSafeInteger(index)||length!==void 0&&!Number.isSafeInteger(length))throw RangeError("Mask coordinates must be safe integers");if(character==="")return value;const chars=Array.from(value),len=chars.length,start=index<0?Math.max(0,len+index):index;if(start>=len)return value;const maskLen=length===void 0?len-start:Math.max(0,length);if(maskLen===0)return value;const end=Math.min(len,start+maskLen),fill=(Array.from(character)[0]??"").repeat(end-start);return chars.slice(0,start).join("")+fill+chars.slice(end).join("")}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/strings",
3
3
  "type": "module",
4
- "version": "0.75.447",
4
+ "version": "0.75.451",
5
5
  "description": "The Stacks string utilities.",
6
6
  "author": "Chris Breuer",
7
7
  "contributors": [
@@ -69,9 +69,9 @@
69
69
  "prepublishOnly": "bun run build"
70
70
  },
71
71
  "devDependencies": {
72
- "@stacksjs/alias": "0.75.447",
72
+ "@stacksjs/alias": "0.75.451",
73
73
  "better-dx": "^0.2.24",
74
- "@stacksjs/types": "0.75.447"
74
+ "@stacksjs/types": "0.75.451"
75
75
  },
76
76
  "sideEffects": false
77
77
  }