MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / prefixMatchesModel

Function prefixMatchesModel

source code/utils/model/modelAllowlist.ts:29–34  ·  view source on GitHub ↗

* Check if a model name starts with a prefix at a segment boundary. * The prefix must match up to the end of the name or a "-" separator. * e.g. "claude-opus-4-5" matches "claude-opus-4-5-20251101" but not "claude-opus-4-50".

(modelName: string, prefix: string)

Source from the content-addressed store, hash-verified

27 * e.g. "claude-opus-4-5" matches "claude-opus-4-5-20251101" but not "claude-opus-4-50".
28 */
29function prefixMatchesModel(modelName: string, prefix: string): boolean {
30 if (!modelName.startsWith(prefix)) {
31 return false
32 }
33 return modelName.length === prefix.length || modelName[prefix.length] === '-'
34}
35
36/**
37 * Check if a model matches a version-prefix entry in the allowlist.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected