remix-forms
Advanced tools
Comparing version
@@ -563,6 +563,17 @@ // src/schema-form.tsx | ||
var _a; | ||
const matches = (_a = str.match( | ||
/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g | ||
const words = (_a = str.match( | ||
/[\p{Lu}]{2,}(?=[\p{Lu}][\p{Ll}]|[\p{N}]|\b)|[\p{Lu}]?[\p{Ll}]+(?:'\p{Ll}+)?(?:[\p{N}]*)|'\p{Ll}+|[\p{Lu}]|[\p{N}]+/gu | ||
)) != null ? _a : [""]; | ||
return matches.map((x) => x.charAt(0).toUpperCase() + x.slice(1)).join(" "); | ||
const format = (w) => { | ||
if (w.startsWith("'") && w.length > 2) { | ||
return `'${w[1].toUpperCase()}${w.slice(2)}`; | ||
} | ||
return w.charAt(0).toUpperCase() + w.slice(1); | ||
}; | ||
return words.reduce((acc, word, index) => { | ||
const formatted = format(word); | ||
if (index === 0) return formatted; | ||
if (word.startsWith("'")) return acc + formatted; | ||
return `${acc} ${formatted}`; | ||
}, ""); | ||
} | ||
@@ -569,0 +580,0 @@ function inferLabel(fieldName) { |
{ | ||
"name": "remix-forms", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "The full-stack form library for React Router v7", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.cjs", |
Sorry, the diff of this file is not supported yet
104899
0.72%2408
0.92%