Skip to content

@saflib/utils


index ​

Interfaces ​

InterfaceDescription
ElementStringObjectStrings that are exported by client packages will be in objects like these. Their values match valid HTML attributes.

Type Aliases ​

Type AliasDescription
ElementStringA string for an HTML element can either be a plain string, or an object with valid HTML attributes.

Functions ​

FunctionDescription
addNewLinesToStringGiven a string which may have newlines already included, add /n to each line such that no line is longer than maxLineWidth.
convertI18NInterpolationToRegexUtility function to convert the vue-i18n message format syntax to a regex for finding an instance of that string, in particular for tests. https://vue-i18n.intlify.dev/guide/essentials/syntax.html
generateShortIdShort random ID (12 base64url chars by default). Uses crypto.getRandomValues; URL-safe. Default byteLength 9 → 72 bits of entropy. Optional byteLength override for callers that need a different width.
kebabCaseToCamelCaseConvert a kebab-case string to camelCase.
kebabCaseToPascalCaseConvert a kebab-case string to PascalCase.
kebabCaseToSnakeCaseConvert a kebab-case string to snake_case.
sanitizeFilename-

References ​

ReturnsError ​

Re-exports ReturnsError


throwError ​

Re-exports throwError