MCPcopy Create free account
hub / github.com/formkit/formkit / patternMatches

Function patternMatches

packages/react/src/composables/useInput.ts:172–186  ·  view source on GitHub ↗
(
  key: string,
  patterns: Array<string | RegExp> | Set<string | RegExp>
)

Source from the content-addressed store, hash-verified

170}
171
172function patternMatches(
173 key: string,
174 patterns: Array<string | RegExp> | Set<string | RegExp>
175): boolean {
176 for (const pattern of patterns) {
177 if (typeof pattern === 'string') {
178 if (pattern === key || camel(pattern) === key || kebab(pattern) === key) {
179 return true
180 }
181 } else if (pattern.test(key)) {
182 return true
183 }
184 }
185 return false
186}
187
188function getModelValue(props: Record<string, any>): unknown {
189 if (props.modelValue !== undefined) return props.modelValue

Callers 1

useInputFunction · 0.85

Calls 2

camelFunction · 0.90
kebabFunction · 0.90

Tested by

no test coverage detected