Files
MapLibreParticleLab/packages/maplibre-particle-rn/src/EncodedFieldGuards.ts
OpenAI Codex 75a974e775
Some checks failed
validate-scripts / validate-scripts (push) Has been cancelled
fix: close STEP-078 V4 bridge guard audit
2026-09-13 17:14:50 +08:00

10 lines
376 B
TypeScript

const MAX_ENCODED_ID_UTF8_BYTES = 64;
/** Transport guard only; Core retains its own field/profile structural rules. */
export function hasValidEncodedIdUtf8Length(value: unknown): value is string {
return typeof value === "string" && (() => {
const bytes = new TextEncoder().encode(value).length;
return bytes >= 1 && bytes <= MAX_ENCODED_ID_UTF8_BYTES;
})();
}