MCPcopy Create free account
hub / github.com/Forward-Future/loopy / requiredString

Function requiredString

loop-library/worker/src/loop-schema.js:171–183  ·  view source on GitHub ↗
(value, field, maxLength)

Source from the content-addressed store, hash-verified

169}
170
171function requiredString(value, field, maxLength) {
172 if (typeof value !== "string") {
173 throw new LoopValidationError(`${field} is required.`);
174 }
175
176 const normalized = value.trim();
177
178 if (!normalized || normalized.length > maxLength) {
179 throw new LoopValidationError(`${field} must be between 1 and ${maxLength} characters.`);
180 }
181
182 return normalized;
183}
184
185function optionalString(value, field, maxLength) {
186 if (value === undefined || value === null || value === "") {

Callers 2

normalizeLoopDocumentFunction · 0.85
stringArrayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected