@digilogiclabs/platform-core 1.17.2 → 1.18.0

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/dist/index.mjs CHANGED
@@ -18331,6 +18331,29 @@ function containsHtml(str) {
18331
18331
  function stripHtml(str) {
18332
18332
  return str.replace(/<[^>]*>/g, "");
18333
18333
  }
18334
+ function stripNullBytes(value) {
18335
+ if (value === null || value === void 0) return value;
18336
+ return value.replace(/\u0000/g, "");
18337
+ }
18338
+ function stripNullBytesDeep(value, depth = 8) {
18339
+ if (depth <= 0) {
18340
+ throw new Error("stripNullBytesDeep: max depth exceeded (circular?)");
18341
+ }
18342
+ if (typeof value === "string") {
18343
+ return value.replace(/\u0000/g, "");
18344
+ }
18345
+ if (Array.isArray(value)) {
18346
+ return value.map((v) => stripNullBytesDeep(v, depth - 1));
18347
+ }
18348
+ if (value !== null && typeof value === "object") {
18349
+ const out = {};
18350
+ for (const [k, v] of Object.entries(value)) {
18351
+ out[k] = stripNullBytesDeep(v, depth - 1);
18352
+ }
18353
+ return out;
18354
+ }
18355
+ return value;
18356
+ }
18334
18357
  function defangUrl(str) {
18335
18358
  return str.replace(/https:\/\//gi, "hxxps://").replace(/http:\/\//gi, "hxxp://").replace(/ftp:\/\//gi, "fxp://").replace(
18336
18359
  /\.(com|net|org|io|co|dev|app|xyz|info|biz|me|us|uk|edu|gov)\b/gi,
@@ -33720,6 +33743,8 @@ export {
33720
33743
  sqlMigration,
33721
33744
  storeBetaCode,
33722
33745
  stripHtml,
33746
+ stripNullBytes,
33747
+ stripNullBytesDeep,
33723
33748
  timedHealthCheck,
33724
33749
  toHealthCheckResult,
33725
33750
  validateBetaCode,