@holoscript/std 3.1.1 → 6.0.3

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.
Files changed (106) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/dist/__tests__/EconomicPrimitives.test.d.ts +2 -0
  4. package/dist/__tests__/EconomicTraits.test.d.ts +2 -0
  5. package/dist/__tests__/SimulationLabPrimitives.test.d.ts +2 -0
  6. package/dist/__tests__/collections.test.d.ts +2 -0
  7. package/dist/__tests__/events.test.d.ts +2 -0
  8. package/dist/__tests__/index.test.d.ts +2 -0
  9. package/dist/__tests__/index.test.d.ts.map +1 -0
  10. package/dist/__tests__/materials.test.d.ts +2 -0
  11. package/dist/__tests__/math.test.d.ts +2 -0
  12. package/dist/__tests__/physics.test.d.ts +2 -0
  13. package/dist/__tests__/spatial.test.d.ts +2 -0
  14. package/dist/__tests__/standard-library-fundamentals.test.d.ts +2 -0
  15. package/dist/__tests__/standard-library-fundamentals.test.d.ts.map +1 -0
  16. package/dist/__tests__/string-and-time-utilities.test.d.ts +2 -0
  17. package/dist/__tests__/string-and-time-utilities.test.d.ts.map +1 -0
  18. package/dist/__tests__/string-decoupled.test.d.ts +2 -0
  19. package/dist/__tests__/string.test.d.ts +2 -0
  20. package/dist/__tests__/time.test.d.ts +2 -0
  21. package/dist/chunk-7HVUYGPS.js +679 -0
  22. package/dist/chunk-7HVUYGPS.js.map +1 -0
  23. package/dist/chunk-P4O3WNG2.js +287 -0
  24. package/dist/chunk-P4O3WNG2.js.map +1 -0
  25. package/dist/chunk-PFX2JM4X.js +683 -0
  26. package/dist/chunk-PFX2JM4X.js.map +1 -0
  27. package/dist/chunk-W2Q3LUCM.js +348 -0
  28. package/dist/chunk-W2Q3LUCM.js.map +1 -0
  29. package/dist/chunk-WS6W35YC.js +443 -0
  30. package/dist/chunk-WS6W35YC.js.map +1 -0
  31. package/dist/chunk-ZXVZAQCZ.js +470 -0
  32. package/dist/chunk-ZXVZAQCZ.js.map +1 -0
  33. package/dist/collections.cjs +715 -0
  34. package/dist/collections.cjs.map +1 -0
  35. package/dist/collections.d.ts +177 -0
  36. package/dist/collections.js +17 -0
  37. package/dist/collections.js.map +1 -0
  38. package/dist/events.d.ts +32 -0
  39. package/dist/index.cjs +4101 -0
  40. package/dist/index.cjs.map +1 -0
  41. package/dist/index.d.ts +101 -0
  42. package/dist/index.js +1270 -190
  43. package/dist/index.js.map +1 -0
  44. package/dist/materials.d.ts +50 -0
  45. package/dist/math.cjs +591 -0
  46. package/dist/math.cjs.map +1 -0
  47. package/dist/math.d.ts +162 -0
  48. package/dist/math.js +53 -0
  49. package/dist/math.js.map +1 -0
  50. package/dist/physics.d.ts +59 -0
  51. package/dist/spatial.d.ts +82 -0
  52. package/dist/string.basic.test.d.ts +5 -0
  53. package/dist/string.basic.test.d.ts.map +1 -0
  54. package/dist/string.cjs +422 -0
  55. package/dist/string.cjs.map +1 -0
  56. package/dist/string.d.ts +212 -0
  57. package/dist/string.d.ts.map +1 -1
  58. package/dist/string.js +107 -0
  59. package/dist/string.js.map +1 -0
  60. package/dist/string.test.d.ts +5 -0
  61. package/dist/string.test.d.ts.map +1 -0
  62. package/dist/time.cjs +512 -0
  63. package/dist/time.cjs.map +1 -0
  64. package/dist/time.d.ts +215 -0
  65. package/dist/time.js +43 -0
  66. package/dist/time.js.map +1 -0
  67. package/dist/traits/ARTraits.d.ts +14 -0
  68. package/dist/traits/EconomicPrimitives.cjs +335 -0
  69. package/dist/traits/EconomicPrimitives.cjs.map +1 -0
  70. package/dist/traits/EconomicPrimitives.d.ts +345 -0
  71. package/dist/traits/EconomicPrimitives.js +55 -0
  72. package/dist/traits/EconomicPrimitives.js.map +1 -0
  73. package/dist/traits/EconomicTraits.cjs +471 -0
  74. package/dist/traits/EconomicTraits.cjs.map +1 -0
  75. package/dist/traits/EconomicTraits.d.ts +71 -0
  76. package/dist/traits/EconomicTraits.js +17 -0
  77. package/dist/traits/EconomicTraits.js.map +1 -0
  78. package/dist/traits/IoTTraits.d.ts +14 -0
  79. package/dist/traits/SimulationLabPrimitives.d.ts +187 -0
  80. package/dist/traits/SimulationLabTraits.d.ts +42 -0
  81. package/dist/traits/VRRTraits.d.ts +150 -0
  82. package/dist/traits/__tests__/ARTraits.test.d.ts +2 -0
  83. package/dist/traits/__tests__/ARTraits.test.d.ts.map +1 -0
  84. package/dist/traits/__tests__/EconomicPrimitives.test.d.ts +2 -0
  85. package/dist/traits/__tests__/EconomicPrimitives.test.d.ts.map +1 -0
  86. package/dist/traits/__tests__/EconomicTraits.test.d.ts +2 -0
  87. package/dist/traits/__tests__/EconomicTraits.test.d.ts.map +1 -0
  88. package/dist/types.d.ts +202 -0
  89. package/error-utf8.log +6 -0
  90. package/error.log +0 -0
  91. package/package.json +30 -18
  92. package/src/__tests__/index.test.ts +14 -0
  93. package/src/__tests__/{Sprint33.test.ts → standard-library-fundamentals.test.ts} +70 -70
  94. package/src/__tests__/{Sprint56.test.ts → string-and-time-utilities.test.ts} +64 -64
  95. package/src/__tests__/string-decoupled.test.ts +0 -2
  96. package/src/string.basic.test.ts +1 -1
  97. package/src/string.test.ts +4 -4
  98. package/src/string.ts +30 -15
  99. package/src/time.ts +1 -1
  100. package/src/traits/__tests__/ARTraits.test.ts +14 -0
  101. package/src/traits/__tests__/EconomicPrimitives.test.ts +14 -0
  102. package/src/traits/__tests__/EconomicTraits.test.ts +14 -0
  103. package/std_error.log +5 -0
  104. package/tsup.config.ts +17 -0
  105. package/dist/__tests__/Sprint33.test.d.ts.map +0 -1
  106. package/dist/__tests__/Sprint56.test.d.ts.map +0 -1
@@ -0,0 +1,422 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/string.ts
21
+ var string_exports = {};
22
+ __export(string_exports, {
23
+ camelCase: () => camelCase,
24
+ capitalize: () => capitalize,
25
+ center: () => center,
26
+ chars: () => chars,
27
+ collapseWhitespace: () => collapseWhitespace,
28
+ constantCase: () => constantCase,
29
+ containsIgnoreCase: () => containsIgnoreCase,
30
+ count: () => count,
31
+ dedent: () => dedent,
32
+ endsWithIgnoreCase: () => endsWithIgnoreCase,
33
+ escapeHtml: () => escapeHtml,
34
+ escapeRegex: () => escapeRegex,
35
+ extractTraits: () => extractTraits,
36
+ format: () => format,
37
+ formatBytes: () => formatBytes,
38
+ formatDuration: () => formatDuration,
39
+ formatNumber: () => formatNumber,
40
+ indent: () => indent,
41
+ isAlpha: () => isAlpha,
42
+ isAlphanumeric: () => isAlphanumeric,
43
+ isBlank: () => isBlank,
44
+ isNotBlank: () => isNotBlank,
45
+ isNumeric: () => isNumeric,
46
+ isValidIdentifier: () => isValidIdentifier,
47
+ join: () => join,
48
+ kebabCase: () => kebabCase,
49
+ levenshtein: () => levenshtein,
50
+ lines: () => lines,
51
+ numberWithCommas: () => numberWithCommas,
52
+ padLeft: () => padLeft,
53
+ padRight: () => padRight,
54
+ pascalCase: () => pascalCase,
55
+ randomString: () => randomString,
56
+ removePrefix: () => removePrefix,
57
+ removeSuffix: () => removeSuffix,
58
+ removeWhitespace: () => removeWhitespace,
59
+ repeat: () => repeat,
60
+ reverse: () => reverse,
61
+ similarity: () => similarity,
62
+ slugify: () => slugify,
63
+ snakeCase: () => snakeCase,
64
+ startsWithIgnoreCase: () => startsWithIgnoreCase,
65
+ titleCase: () => titleCase,
66
+ truncate: () => truncate,
67
+ truncateMiddle: () => truncateMiddle,
68
+ unescapeHtml: () => unescapeHtml,
69
+ unwrap: () => unwrap,
70
+ uuid: () => uuid,
71
+ wordWrap: () => wordWrap,
72
+ words: () => words,
73
+ wrap: () => wrap
74
+ });
75
+ module.exports = __toCommonJS(string_exports);
76
+ function isBlank(s) {
77
+ return s.trim().length === 0;
78
+ }
79
+ function isNotBlank(s) {
80
+ return s.trim().length > 0;
81
+ }
82
+ function capitalize(s) {
83
+ if (s.length === 0) return s;
84
+ return s[0].toUpperCase() + s.slice(1);
85
+ }
86
+ function titleCase(s) {
87
+ return s.split(/\s+/).map(capitalize).join(" ");
88
+ }
89
+ function camelCase(s) {
90
+ return s.replace(/[-_\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : "").replace(/^[A-Z]/, (c) => c.toLowerCase());
91
+ }
92
+ function pascalCase(s) {
93
+ const camel = camelCase(s);
94
+ return camel.length > 0 ? camel[0].toUpperCase() + camel.slice(1) : camel;
95
+ }
96
+ function snakeCase(s) {
97
+ return s.replace(/([a-z])([A-Z])/g, "$1_$2").replace(/[-\s]+/g, "_").toLowerCase();
98
+ }
99
+ function kebabCase(s) {
100
+ return s.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[_\s]+/g, "-").toLowerCase();
101
+ }
102
+ function constantCase(s) {
103
+ return snakeCase(s).toUpperCase();
104
+ }
105
+ function padLeft(s, length, char = " ") {
106
+ return s.padStart(length, char);
107
+ }
108
+ function padRight(s, length, char = " ") {
109
+ return s.padEnd(length, char);
110
+ }
111
+ function center(s, length, char = " ") {
112
+ if (s.length >= length) return s;
113
+ const totalPadding = length - s.length;
114
+ const leftPadding = Math.floor(totalPadding / 2);
115
+ const rightPadding = totalPadding - leftPadding;
116
+ return char.repeat(leftPadding) + s + char.repeat(rightPadding);
117
+ }
118
+ function truncate(s, maxLength, ellipsis = "...") {
119
+ if (s.length <= maxLength) return s;
120
+ return s.slice(0, maxLength - ellipsis.length) + ellipsis;
121
+ }
122
+ function truncateMiddle(s, maxLength, ellipsis = "...") {
123
+ if (s.length <= maxLength) return s;
124
+ const availableLength = maxLength - ellipsis.length;
125
+ const leftLength = Math.floor(availableLength / 2);
126
+ const rightLength = Math.ceil(availableLength / 2);
127
+ return s.slice(0, leftLength) + ellipsis + s.slice(-rightLength);
128
+ }
129
+ function repeat(s, count2) {
130
+ return s.repeat(count2);
131
+ }
132
+ function reverse(s) {
133
+ return [...s].reverse().join("");
134
+ }
135
+ function count(s, substring) {
136
+ if (substring.length === 0) return 0;
137
+ let count2 = 0;
138
+ let pos = 0;
139
+ while ((pos = s.indexOf(substring, pos)) !== -1) {
140
+ count2++;
141
+ pos += 1;
142
+ }
143
+ return count2;
144
+ }
145
+ function containsIgnoreCase(s, substring) {
146
+ return s.toLowerCase().includes(substring.toLowerCase());
147
+ }
148
+ function startsWithIgnoreCase(s, prefix) {
149
+ return s.toLowerCase().startsWith(prefix.toLowerCase());
150
+ }
151
+ function endsWithIgnoreCase(s, suffix) {
152
+ return s.toLowerCase().endsWith(suffix.toLowerCase());
153
+ }
154
+ function removeWhitespace(s) {
155
+ return s.replace(/\s+/g, "");
156
+ }
157
+ function collapseWhitespace(s) {
158
+ return s.replace(/\s+/g, " ").trim();
159
+ }
160
+ function removePrefix(s, prefix) {
161
+ return s.startsWith(prefix) ? s.slice(prefix.length) : s;
162
+ }
163
+ function removeSuffix(s, suffix) {
164
+ return s.endsWith(suffix) ? s.slice(0, -suffix.length) : s;
165
+ }
166
+ function wrap(s, prefixOrWrapper, suffix) {
167
+ if (suffix === void 0) {
168
+ return prefixOrWrapper + s + prefixOrWrapper;
169
+ }
170
+ return prefixOrWrapper + s + suffix;
171
+ }
172
+ function unwrap(s, prefixOrWrapper, suffix) {
173
+ const prefix = prefixOrWrapper;
174
+ const actualSuffix = suffix ?? prefixOrWrapper;
175
+ if (s.startsWith(prefix) && s.endsWith(actualSuffix)) {
176
+ return s.slice(prefix.length, -actualSuffix.length || void 0);
177
+ }
178
+ return s;
179
+ }
180
+ function lines(s) {
181
+ return s.split(/\r?\n/);
182
+ }
183
+ function words(s) {
184
+ return s.split(/\s+/).filter((w) => w.length > 0);
185
+ }
186
+ function chars(s) {
187
+ return [...s];
188
+ }
189
+ function join(strings, separator = "") {
190
+ return strings.join(separator);
191
+ }
192
+ function format(template, values) {
193
+ return template.replace(/\{(\w+)\}/g, (match, key) => {
194
+ return key in values ? String(values[key]) : match;
195
+ });
196
+ }
197
+ function formatNumber(n, options = {}) {
198
+ return n.toLocaleString("en-US", options);
199
+ }
200
+ function numberWithCommas(n) {
201
+ return n.toLocaleString("en-US");
202
+ }
203
+ function formatBytes(bytes, decimals = 2) {
204
+ if (bytes === 0) return "0 B";
205
+ const k = 1024;
206
+ if (bytes < 0) return `${bytes} B`;
207
+ const sizes = ["B", "KB", "MB", "GB", "TB", "PB"];
208
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
209
+ return parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)) + " " + sizes[i];
210
+ }
211
+ function formatDuration(ms) {
212
+ if (ms < 1e3) return `${ms}ms`;
213
+ if (ms < 6e4) return `${(ms / 1e3).toFixed(1)}s`;
214
+ if (ms < 36e5) {
215
+ return `${(ms / 6e4).toFixed(1)}m`;
216
+ }
217
+ const hours = Math.floor(ms / 36e5);
218
+ const mins = Math.floor(ms % 36e5 / 6e4);
219
+ return `${(ms / 36e5).toFixed(1)}h`;
220
+ }
221
+ function escapeHtml(s) {
222
+ const htmlEntities = {
223
+ "&": "&amp;",
224
+ "<": "&lt;",
225
+ ">": "&gt;",
226
+ '"': "&quot;",
227
+ "'": "&#39;"
228
+ };
229
+ return s.replace(/[&<>"']/g, (c) => htmlEntities[c]);
230
+ }
231
+ function unescapeHtml(s) {
232
+ const htmlEntities = {
233
+ "&amp;": "&",
234
+ "&lt;": "<",
235
+ "&gt;": ">",
236
+ "&quot;": '"',
237
+ "&#39;": "'",
238
+ "&#x27;": "'",
239
+ "&#x2F;": "/"
240
+ };
241
+ return s.replace(
242
+ /&(?:amp|lt|gt|quot|#39|#x27|#x2F);/g,
243
+ (entity) => htmlEntities[entity] || entity
244
+ );
245
+ }
246
+ function escapeRegex(s) {
247
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
248
+ }
249
+ function slugify(s) {
250
+ return s.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
251
+ }
252
+ function isValidIdentifier(s) {
253
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(s);
254
+ }
255
+ function isNumeric(s) {
256
+ return !isNaN(parseFloat(s)) && isFinite(Number(s));
257
+ }
258
+ function isAlphanumeric(s) {
259
+ return /^[a-zA-Z0-9]+$/.test(s);
260
+ }
261
+ function isAlpha(s) {
262
+ return /^[a-zA-Z]+$/.test(s);
263
+ }
264
+ function randomString(length, charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") {
265
+ let result = "";
266
+ for (let i = 0; i < length; i++) {
267
+ result += charset[Math.floor(Math.random() * charset.length)];
268
+ }
269
+ return result;
270
+ }
271
+ function uuid() {
272
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
273
+ const r = Math.random() * 16 | 0;
274
+ const v = c === "x" ? r : r & 3 | 8;
275
+ return v.toString(16);
276
+ });
277
+ }
278
+ function indent(s, spaces, char = " ") {
279
+ const prefix = char.repeat(spaces);
280
+ return s.split("\n").map((line) => prefix + line).join("\n");
281
+ }
282
+ function dedent(s) {
283
+ const linesList = lines(s);
284
+ const nonEmptyLines = linesList.filter((l) => l.trim().length > 0);
285
+ if (nonEmptyLines.length === 0) return s;
286
+ const minIndent = Math.min(
287
+ ...nonEmptyLines.map((line) => {
288
+ const match = line.match(/^(\s*)/);
289
+ return match ? match[1].length : 0;
290
+ })
291
+ );
292
+ return linesList.map((line) => line.slice(minIndent)).join("\n");
293
+ }
294
+ function wordWrap(s, maxWidth) {
295
+ const wordsList = words(s);
296
+ const linesList = [];
297
+ let currentLine = "";
298
+ for (const word of wordsList) {
299
+ if (currentLine.length === 0) {
300
+ currentLine = word;
301
+ } else if (currentLine.length + 1 + word.length <= maxWidth) {
302
+ currentLine += " " + word;
303
+ } else {
304
+ linesList.push(currentLine);
305
+ currentLine = word;
306
+ }
307
+ }
308
+ if (currentLine.length > 0) {
309
+ linesList.push(currentLine);
310
+ }
311
+ return linesList.join("\n");
312
+ }
313
+ function levenshtein(a, b) {
314
+ if (a.length === 0) return b.length;
315
+ if (b.length === 0) return a.length;
316
+ const matrix = [];
317
+ for (let i = 0; i <= b.length; i++) {
318
+ matrix[i] = [i];
319
+ }
320
+ for (let j = 0; j <= a.length; j++) {
321
+ matrix[0][j] = j;
322
+ }
323
+ for (let i = 1; i <= b.length; i++) {
324
+ for (let j = 1; j <= a.length; j++) {
325
+ if (b[i - 1] === a[j - 1]) {
326
+ matrix[i][j] = matrix[i - 1][j - 1];
327
+ } else {
328
+ matrix[i][j] = Math.min(
329
+ matrix[i - 1][j - 1] + 1,
330
+ // substitution
331
+ matrix[i][j - 1] + 1,
332
+ // insertion
333
+ matrix[i - 1][j] + 1
334
+ // deletion
335
+ );
336
+ }
337
+ }
338
+ }
339
+ return matrix[b.length][a.length];
340
+ }
341
+ function lcsLength(a, b) {
342
+ const n = b.length;
343
+ const dp = new Array(n + 1).fill(0);
344
+ for (let i = 0; i < a.length; i++) {
345
+ let prev = 0;
346
+ for (let j = 0; j < n; j++) {
347
+ const tmp = dp[j + 1];
348
+ dp[j + 1] = a[i] === b[j] ? prev + 1 : Math.max(dp[j + 1], dp[j]);
349
+ prev = tmp;
350
+ }
351
+ }
352
+ return dp[n];
353
+ }
354
+ function similarity(a, b) {
355
+ const total = a.length + b.length;
356
+ if (total === 0) return 1;
357
+ return 2 * lcsLength(a, b) / total;
358
+ }
359
+ function extractTraits(code) {
360
+ const traits = /* @__PURE__ */ new Set();
361
+ let m;
362
+ const atRe = /@([a-zA-Z_]\w*)/g;
363
+ while ((m = atRe.exec(code)) !== null) traits.add(`@${m[1]}`);
364
+ const tagRe = /<([A-Z][a-zA-Z0-9]*)\b/g;
365
+ while ((m = tagRe.exec(code)) !== null) traits.add(m[1]);
366
+ return [...traits];
367
+ }
368
+ // Annotate the CommonJS export names for ESM import in node:
369
+ 0 && (module.exports = {
370
+ camelCase,
371
+ capitalize,
372
+ center,
373
+ chars,
374
+ collapseWhitespace,
375
+ constantCase,
376
+ containsIgnoreCase,
377
+ count,
378
+ dedent,
379
+ endsWithIgnoreCase,
380
+ escapeHtml,
381
+ escapeRegex,
382
+ extractTraits,
383
+ format,
384
+ formatBytes,
385
+ formatDuration,
386
+ formatNumber,
387
+ indent,
388
+ isAlpha,
389
+ isAlphanumeric,
390
+ isBlank,
391
+ isNotBlank,
392
+ isNumeric,
393
+ isValidIdentifier,
394
+ join,
395
+ kebabCase,
396
+ levenshtein,
397
+ lines,
398
+ numberWithCommas,
399
+ padLeft,
400
+ padRight,
401
+ pascalCase,
402
+ randomString,
403
+ removePrefix,
404
+ removeSuffix,
405
+ removeWhitespace,
406
+ repeat,
407
+ reverse,
408
+ similarity,
409
+ slugify,
410
+ snakeCase,
411
+ startsWithIgnoreCase,
412
+ titleCase,
413
+ truncate,
414
+ truncateMiddle,
415
+ unescapeHtml,
416
+ unwrap,
417
+ uuid,
418
+ wordWrap,
419
+ words,
420
+ wrap
421
+ });
422
+ //# sourceMappingURL=string.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/string.ts"],"sourcesContent":["/**\n * @holoscript/std - String Module\n *\n * String manipulation utilities for HoloScript Plus programs.\n */\n\n/**\n * Check if a string is empty or only whitespace\n */\nexport function isBlank(s: string): boolean {\n return s.trim().length === 0;\n}\n\n/**\n * Check if a string is not empty and not only whitespace\n */\nexport function isNotBlank(s: string): boolean {\n return s.trim().length > 0;\n}\n\n/**\n * Capitalize the first letter of a string\n */\nexport function capitalize(s: string): string {\n if (s.length === 0) return s;\n return s[0].toUpperCase() + s.slice(1);\n}\n\n/**\n * Capitalize the first letter of each word\n */\nexport function titleCase(s: string): string {\n return s.split(/\\s+/).map(capitalize).join(' ');\n}\n\n/**\n * Convert to camelCase\n */\nexport function camelCase(s: string): string {\n return s\n .replace(/[-_\\s]+(.)?/g, (_, c) => (c ? c.toUpperCase() : ''))\n .replace(/^[A-Z]/, (c) => c.toLowerCase());\n}\n\n/**\n * Convert to PascalCase\n */\nexport function pascalCase(s: string): string {\n const camel = camelCase(s);\n return camel.length > 0 ? camel[0].toUpperCase() + camel.slice(1) : camel;\n}\n\n/**\n * Convert to snake_case\n */\nexport function snakeCase(s: string): string {\n return s\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[-\\s]+/g, '_')\n .toLowerCase();\n}\n\n/**\n * Convert to kebab-case\n */\nexport function kebabCase(s: string): string {\n return s\n .replace(/([a-z])([A-Z])/g, '$1-$2')\n .replace(/[_\\s]+/g, '-')\n .toLowerCase();\n}\n\n/**\n * Convert to SCREAMING_SNAKE_CASE\n */\nexport function constantCase(s: string): string {\n return snakeCase(s).toUpperCase();\n}\n\n/**\n * Pad a string on the left to reach target length\n */\nexport function padLeft(s: string, length: number, char = ' '): string {\n return s.padStart(length, char);\n}\n\n/**\n * Pad a string on the right to reach target length\n */\nexport function padRight(s: string, length: number, char = ' '): string {\n return s.padEnd(length, char);\n}\n\n/**\n * Pad a string on both sides to center it\n */\nexport function center(s: string, length: number, char = ' '): string {\n if (s.length >= length) return s;\n const totalPadding = length - s.length;\n const leftPadding = Math.floor(totalPadding / 2);\n const rightPadding = totalPadding - leftPadding;\n return char.repeat(leftPadding) + s + char.repeat(rightPadding);\n}\n\n/**\n * Truncate a string to max length, adding ellipsis if needed\n */\nexport function truncate(s: string, maxLength: number, ellipsis = '...'): string {\n if (s.length <= maxLength) return s;\n return s.slice(0, maxLength - ellipsis.length) + ellipsis;\n}\n\n/**\n * Truncate a string in the middle\n */\nexport function truncateMiddle(s: string, maxLength: number, ellipsis = '...'): string {\n if (s.length <= maxLength) return s;\n const availableLength = maxLength - ellipsis.length;\n const leftLength = Math.floor(availableLength / 2);\n const rightLength = Math.ceil(availableLength / 2);\n return s.slice(0, leftLength) + ellipsis + s.slice(-rightLength);\n}\n\n/**\n * Repeat a string n times\n */\nexport function repeat(s: string, count: number): string {\n return s.repeat(count);\n}\n\n/**\n * Reverse a string\n */\nexport function reverse(s: string): string {\n return [...s].reverse().join('');\n}\n\n/**\n * Count occurrences of a substring\n */\nexport function count(s: string, substring: string): number {\n if (substring.length === 0) return 0;\n let count = 0;\n let pos = 0;\n while ((pos = s.indexOf(substring, pos)) !== -1) {\n count++;\n pos += 1;\n }\n return count;\n}\n\n/**\n * Check if string contains a substring (case-insensitive)\n */\nexport function containsIgnoreCase(s: string, substring: string): boolean {\n return s.toLowerCase().includes(substring.toLowerCase());\n}\n\n/**\n * Check if string starts with prefix (case-insensitive)\n */\nexport function startsWithIgnoreCase(s: string, prefix: string): boolean {\n return s.toLowerCase().startsWith(prefix.toLowerCase());\n}\n\n/**\n * Check if string ends with suffix (case-insensitive)\n */\nexport function endsWithIgnoreCase(s: string, suffix: string): boolean {\n return s.toLowerCase().endsWith(suffix.toLowerCase());\n}\n\n/**\n * Remove all whitespace from a string\n */\nexport function removeWhitespace(s: string): string {\n return s.replace(/\\s+/g, '');\n}\n\n/**\n * Collapse multiple spaces into single space\n */\nexport function collapseWhitespace(s: string): string {\n return s.replace(/\\s+/g, ' ').trim();\n}\n\n/**\n * Remove a prefix if present\n */\nexport function removePrefix(s: string, prefix: string): string {\n return s.startsWith(prefix) ? s.slice(prefix.length) : s;\n}\n\n/**\n * Remove a suffix if present\n */\nexport function removeSuffix(s: string, suffix: string): string {\n return s.endsWith(suffix) ? s.slice(0, -suffix.length) : s;\n}\n\n/**\n * Wrap a string with prefix and suffix\n */\nexport function wrap(s: string, wrapper: string): string;\nexport function wrap(s: string, prefix: string, suffix: string): string;\nexport function wrap(s: string, prefixOrWrapper: string, suffix?: string): string {\n if (suffix === undefined) {\n return prefixOrWrapper + s + prefixOrWrapper;\n }\n return prefixOrWrapper + s + suffix;\n}\n\n/**\n * Unwrap a string by removing matching prefix and suffix\n */\nexport function unwrap(s: string, wrapper: string): string;\nexport function unwrap(s: string, prefix: string, suffix: string): string;\nexport function unwrap(s: string, prefixOrWrapper: string, suffix?: string): string {\n const prefix = prefixOrWrapper;\n const actualSuffix = suffix ?? prefixOrWrapper;\n if (s.startsWith(prefix) && s.endsWith(actualSuffix)) {\n return s.slice(prefix.length, -actualSuffix.length || undefined);\n }\n return s;\n}\n\n/**\n * Split a string into lines\n */\nexport function lines(s: string): string[] {\n return s.split(/\\r?\\n/);\n}\n\n/**\n * Split a string into words\n */\nexport function words(s: string): string[] {\n return s.split(/\\s+/).filter((w) => w.length > 0);\n}\n\n/**\n * Split a string into characters\n */\nexport function chars(s: string): string[] {\n return [...s];\n}\n\n/**\n * Join strings with a separator\n */\nexport function join(strings: string[], separator = ''): string {\n return strings.join(separator);\n}\n\n/**\n * Format a template string with values\n */\nexport function format(template: string, values: Record<string, unknown>): string {\n return template.replace(/\\{(\\w+)\\}/g, (match, key) => {\n return key in values ? String(values[key]) : match;\n });\n}\n\n/**\n * Format a number as a string with grouping\n */\nexport function formatNumber(n: number, options: Intl.NumberFormatOptions = {}): string {\n return n.toLocaleString('en-US', options);\n}\n\n/**\n * Format a number with commas\n */\nexport function numberWithCommas(n: number): string {\n return n.toLocaleString('en-US');\n}\n\n/**\n * Format bytes as human-readable string\n */\nexport function formatBytes(bytes: number, decimals = 2): string {\n if (bytes === 0) return '0 B';\n const k = 1024;\n if (bytes < 0) return `${bytes} B`;\n const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n return parseFloat((bytes / Math.pow(k, i)).toFixed(decimals)) + ' ' + sizes[i];\n}\n\n/**\n * Format duration in milliseconds as human-readable string\n */\nexport function formatDuration(ms: number): string {\n if (ms < 1000) return `${ms}ms`;\n if (ms < 60000) return `${(ms / 1000).toFixed(1)}s`;\n if (ms < 3600000) {\n return `${(ms / 60000).toFixed(1)}m`;\n }\n const hours = Math.floor(ms / 3600000);\n const mins = Math.floor((ms % 3600000) / 60000);\n return `${(ms / 3600000).toFixed(1)}h`;\n}\n\n/**\n * Escape HTML special characters\n */\nexport function escapeHtml(s: string): string {\n const htmlEntities: Record<string, string> = {\n '&': '&amp;',\n '<': '&lt;',\n '>': '&gt;',\n '\"': '&quot;',\n \"'\": '&#39;',\n };\n return s.replace(/[&<>\"']/g, (c) => htmlEntities[c]);\n}\n\n/**\n * Unescape HTML entities\n */\nexport function unescapeHtml(s: string): string {\n const htmlEntities: Record<string, string> = {\n '&amp;': '&',\n '&lt;': '<',\n '&gt;': '>',\n '&quot;': '\"',\n '&#39;': \"'\",\n '&#x27;': \"'\",\n '&#x2F;': '/',\n };\n return s.replace(\n /&(?:amp|lt|gt|quot|#39|#x27|#x2F);/g,\n (entity) => htmlEntities[entity] || entity\n );\n}\n\n/**\n * Escape regex special characters\n */\nexport function escapeRegex(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/**\n * Generate a slug from a string\n */\nexport function slugify(s: string): string {\n return s\n .toLowerCase()\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '') // Remove diacritics\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '');\n}\n\n/**\n * Check if string is a valid identifier\n */\nexport function isValidIdentifier(s: string): boolean {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(s);\n}\n\n/**\n * Check if string is numeric\n */\nexport function isNumeric(s: string): boolean {\n return !isNaN(parseFloat(s)) && isFinite(Number(s));\n}\n\n/**\n * Check if string is alphanumeric\n */\nexport function isAlphanumeric(s: string): boolean {\n return /^[a-zA-Z0-9]+$/.test(s);\n}\n\n/**\n * Check if string is alphabetic\n */\nexport function isAlpha(s: string): boolean {\n return /^[a-zA-Z]+$/.test(s);\n}\n\n/**\n * Generate a random string\n */\nexport function randomString(\n length: number,\n charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'\n): string {\n let result = '';\n for (let i = 0; i < length; i++) {\n result += charset[Math.floor(Math.random() * charset.length)];\n }\n return result;\n}\n\n/**\n * Generate a UUID v4\n */\nexport function uuid(): string {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0;\n const v = c === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\n\n/**\n * Indent each line of a string\n */\nexport function indent(s: string, spaces: number, char = ' '): string {\n const prefix = char.repeat(spaces);\n return s\n .split('\\n')\n .map((line) => prefix + line)\n .join('\\n');\n}\n\n/**\n * Dedent a string (remove common leading whitespace)\n */\nexport function dedent(s: string): string {\n const linesList = lines(s);\n const nonEmptyLines = linesList.filter((l) => l.trim().length > 0);\n if (nonEmptyLines.length === 0) return s;\n\n const minIndent = Math.min(\n ...nonEmptyLines.map((line) => {\n const match = line.match(/^(\\s*)/);\n return match ? match[1].length : 0;\n })\n );\n\n return linesList.map((line) => line.slice(minIndent)).join('\\n');\n}\n\n/**\n * Word wrap text to a maximum width\n */\nexport function wordWrap(s: string, maxWidth: number): string {\n const wordsList = words(s);\n const linesList: string[] = [];\n let currentLine = '';\n\n for (const word of wordsList) {\n if (currentLine.length === 0) {\n currentLine = word;\n } else if (currentLine.length + 1 + word.length <= maxWidth) {\n currentLine += ' ' + word;\n } else {\n linesList.push(currentLine);\n currentLine = word;\n }\n }\n\n if (currentLine.length > 0) {\n linesList.push(currentLine);\n }\n\n return linesList.join('\\n');\n}\n\n/**\n * Levenshtein distance between two strings\n */\nexport function levenshtein(a: string, b: string): number {\n if (a.length === 0) return b.length;\n if (b.length === 0) return a.length;\n\n const matrix: number[][] = [];\n\n for (let i = 0; i <= b.length; i++) {\n matrix[i] = [i];\n }\n for (let j = 0; j <= a.length; j++) {\n matrix[0][j] = j;\n }\n\n for (let i = 1; i <= b.length; i++) {\n for (let j = 1; j <= a.length; j++) {\n if (b[i - 1] === a[j - 1]) {\n matrix[i][j] = matrix[i - 1][j - 1];\n } else {\n matrix[i][j] = Math.min(\n matrix[i - 1][j - 1] + 1, // substitution\n matrix[i][j - 1] + 1, // insertion\n matrix[i - 1][j] + 1 // deletion\n );\n }\n }\n }\n\n return matrix[b.length][a.length];\n}\n\nfunction lcsLength(a: string, b: string): number {\n const n = b.length;\n const dp: number[] = new Array(n + 1).fill(0);\n for (let i = 0; i < a.length; i++) {\n let prev = 0;\n for (let j = 0; j < n; j++) {\n const tmp = dp[j + 1];\n dp[j + 1] = a[i] === b[j] ? prev + 1 : Math.max(dp[j + 1], dp[j]);\n prev = tmp;\n }\n }\n return dp[n];\n}\n\n/**\n * Check similarity between two strings (0-1) using Sorensen-Dice over LCS\n */\nexport function similarity(a: string, b: string): number {\n const total = a.length + b.length;\n if (total === 0) return 1;\n return (2 * lcsLength(a, b)) / total;\n}\n\n/**\n * Extract HoloScript trait annotations (@name) and JSX component names from code\n */\nexport function extractTraits(code: string): string[] {\n const traits = new Set<string>();\n let m: RegExpExecArray | null;\n const atRe = /@([a-zA-Z_]\\w*)/g;\n while ((m = atRe.exec(code)) !== null) traits.add(`@${m[1]}`);\n const tagRe = /<([A-Z][a-zA-Z0-9]*)\\b/g;\n while ((m = tagRe.exec(code)) !== null) traits.add(m[1]);\n return [...traits];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA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AG,QAAO;AACxB,SAAQ,IAAI,UAAU,GAAG,CAAC,IAAK;AACjC;AAKO,SAAS,cAAc,MAAwB;AACpD,QAAM,SAAS,oBAAI,IAAY;AAC/B,MAAI;AACJ,QAAM,OAAO;AACb,UAAQ,IAAI,KAAK,KAAK,IAAI,OAAO,KAAM,QAAO,IAAI,IAAI,EAAE,CAAC,CAAC,EAAE;AAC5D,QAAM,QAAQ;AACd,UAAQ,IAAI,MAAM,KAAK,IAAI,OAAO,KAAM,QAAO,IAAI,EAAE,CAAC,CAAC;AACvD,SAAO,CAAC,GAAG,MAAM;AACnB;","names":["count"]}
@@ -0,0 +1,212 @@
1
+ /**
2
+ * @holoscript/std - String Module
3
+ *
4
+ * String manipulation utilities for HoloScript Plus programs.
5
+ */
6
+ /**
7
+ * Check if a string is empty or only whitespace
8
+ */
9
+ export declare function isBlank(s: string): boolean;
10
+ /**
11
+ * Check if a string is not empty and not only whitespace
12
+ */
13
+ export declare function isNotBlank(s: string): boolean;
14
+ /**
15
+ * Capitalize the first letter of a string
16
+ */
17
+ export declare function capitalize(s: string): string;
18
+ /**
19
+ * Capitalize the first letter of each word
20
+ */
21
+ export declare function titleCase(s: string): string;
22
+ /**
23
+ * Convert to camelCase
24
+ */
25
+ export declare function camelCase(s: string): string;
26
+ /**
27
+ * Convert to PascalCase
28
+ */
29
+ export declare function pascalCase(s: string): string;
30
+ /**
31
+ * Convert to snake_case
32
+ */
33
+ export declare function snakeCase(s: string): string;
34
+ /**
35
+ * Convert to kebab-case
36
+ */
37
+ export declare function kebabCase(s: string): string;
38
+ /**
39
+ * Convert to SCREAMING_SNAKE_CASE
40
+ */
41
+ export declare function constantCase(s: string): string;
42
+ /**
43
+ * Pad a string on the left to reach target length
44
+ */
45
+ export declare function padLeft(s: string, length: number, char?: string): string;
46
+ /**
47
+ * Pad a string on the right to reach target length
48
+ */
49
+ export declare function padRight(s: string, length: number, char?: string): string;
50
+ /**
51
+ * Pad a string on both sides to center it
52
+ */
53
+ export declare function center(s: string, length: number, char?: string): string;
54
+ /**
55
+ * Truncate a string to max length, adding ellipsis if needed
56
+ */
57
+ export declare function truncate(s: string, maxLength: number, ellipsis?: string): string;
58
+ /**
59
+ * Truncate a string in the middle
60
+ */
61
+ export declare function truncateMiddle(s: string, maxLength: number, ellipsis?: string): string;
62
+ /**
63
+ * Repeat a string n times
64
+ */
65
+ export declare function repeat(s: string, count: number): string;
66
+ /**
67
+ * Reverse a string
68
+ */
69
+ export declare function reverse(s: string): string;
70
+ /**
71
+ * Count occurrences of a substring
72
+ */
73
+ export declare function count(s: string, substring: string): number;
74
+ /**
75
+ * Check if string contains a substring (case-insensitive)
76
+ */
77
+ export declare function containsIgnoreCase(s: string, substring: string): boolean;
78
+ /**
79
+ * Check if string starts with prefix (case-insensitive)
80
+ */
81
+ export declare function startsWithIgnoreCase(s: string, prefix: string): boolean;
82
+ /**
83
+ * Check if string ends with suffix (case-insensitive)
84
+ */
85
+ export declare function endsWithIgnoreCase(s: string, suffix: string): boolean;
86
+ /**
87
+ * Remove all whitespace from a string
88
+ */
89
+ export declare function removeWhitespace(s: string): string;
90
+ /**
91
+ * Collapse multiple spaces into single space
92
+ */
93
+ export declare function collapseWhitespace(s: string): string;
94
+ /**
95
+ * Remove a prefix if present
96
+ */
97
+ export declare function removePrefix(s: string, prefix: string): string;
98
+ /**
99
+ * Remove a suffix if present
100
+ */
101
+ export declare function removeSuffix(s: string, suffix: string): string;
102
+ /**
103
+ * Wrap a string with prefix and suffix
104
+ */
105
+ export declare function wrap(s: string, wrapper: string): string;
106
+ export declare function wrap(s: string, prefix: string, suffix: string): string;
107
+ /**
108
+ * Unwrap a string by removing matching prefix and suffix
109
+ */
110
+ export declare function unwrap(s: string, wrapper: string): string;
111
+ export declare function unwrap(s: string, prefix: string, suffix: string): string;
112
+ /**
113
+ * Split a string into lines
114
+ */
115
+ export declare function lines(s: string): string[];
116
+ /**
117
+ * Split a string into words
118
+ */
119
+ export declare function words(s: string): string[];
120
+ /**
121
+ * Split a string into characters
122
+ */
123
+ export declare function chars(s: string): string[];
124
+ /**
125
+ * Join strings with a separator
126
+ */
127
+ export declare function join(strings: string[], separator?: string): string;
128
+ /**
129
+ * Format a template string with values
130
+ */
131
+ export declare function format(template: string, values: Record<string, unknown>): string;
132
+ /**
133
+ * Format a number as a string with grouping
134
+ */
135
+ export declare function formatNumber(n: number, options?: Intl.NumberFormatOptions): string;
136
+ /**
137
+ * Format a number with commas
138
+ */
139
+ export declare function numberWithCommas(n: number): string;
140
+ /**
141
+ * Format bytes as human-readable string
142
+ */
143
+ export declare function formatBytes(bytes: number, decimals?: number): string;
144
+ /**
145
+ * Format duration in milliseconds as human-readable string
146
+ */
147
+ export declare function formatDuration(ms: number): string;
148
+ /**
149
+ * Escape HTML special characters
150
+ */
151
+ export declare function escapeHtml(s: string): string;
152
+ /**
153
+ * Unescape HTML entities
154
+ */
155
+ export declare function unescapeHtml(s: string): string;
156
+ /**
157
+ * Escape regex special characters
158
+ */
159
+ export declare function escapeRegex(s: string): string;
160
+ /**
161
+ * Generate a slug from a string
162
+ */
163
+ export declare function slugify(s: string): string;
164
+ /**
165
+ * Check if string is a valid identifier
166
+ */
167
+ export declare function isValidIdentifier(s: string): boolean;
168
+ /**
169
+ * Check if string is numeric
170
+ */
171
+ export declare function isNumeric(s: string): boolean;
172
+ /**
173
+ * Check if string is alphanumeric
174
+ */
175
+ export declare function isAlphanumeric(s: string): boolean;
176
+ /**
177
+ * Check if string is alphabetic
178
+ */
179
+ export declare function isAlpha(s: string): boolean;
180
+ /**
181
+ * Generate a random string
182
+ */
183
+ export declare function randomString(length: number, charset?: string): string;
184
+ /**
185
+ * Generate a UUID v4
186
+ */
187
+ export declare function uuid(): string;
188
+ /**
189
+ * Indent each line of a string
190
+ */
191
+ export declare function indent(s: string, spaces: number, char?: string): string;
192
+ /**
193
+ * Dedent a string (remove common leading whitespace)
194
+ */
195
+ export declare function dedent(s: string): string;
196
+ /**
197
+ * Word wrap text to a maximum width
198
+ */
199
+ export declare function wordWrap(s: string, maxWidth: number): string;
200
+ /**
201
+ * Levenshtein distance between two strings
202
+ */
203
+ export declare function levenshtein(a: string, b: string): number;
204
+ /**
205
+ * Check similarity between two strings (0-1) using Sorensen-Dice over LCS
206
+ */
207
+ export declare function similarity(a: string, b: string): number;
208
+ /**
209
+ * Extract HoloScript trait annotations (@name) and JSX component names from code
210
+ */
211
+ export declare function extractTraits(code: string): string[];
212
+ //# sourceMappingURL=string.d.ts.map