@ai-matrx/records 0.87.17 → 0.87.19

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.cjs CHANGED
@@ -108,6 +108,7 @@ __export(src_exports, {
108
108
  asChoiceNudge: () => asChoiceNudge,
109
109
  asPermissionLevel: () => asPermissionLevel,
110
110
  atLeast: () => atLeast,
111
+ autonumberJoin: () => autonumberJoin,
111
112
  autonumberPrefixOf: () => autonumberPrefixOf,
112
113
  autonumberSearchOf: () => autonumberSearchOf,
113
114
  autonumberWords: () => autonumberWords,
@@ -1399,7 +1400,10 @@ function autonumberPrefixOf(field) {
1399
1400
  function autonumberWords(field, value) {
1400
1401
  const n = typeof value === "number" ? value : typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value) : NaN;
1401
1402
  if (!Number.isFinite(n)) return null;
1402
- return `${autonumberPrefixOf(field)}${Math.trunc(n)}`;
1403
+ return `${autonumberJoin(autonumberPrefixOf(field))}${Math.trunc(n)}`;
1404
+ }
1405
+ function autonumberJoin(prefix) {
1406
+ return prefix === "" || /[-_#.:/\s]$/.test(prefix) ? prefix : `${prefix}-`;
1403
1407
  }
1404
1408
  function autonumberSearchOf(fields, words) {
1405
1409
  const text = words.trim();