MCPcopy Index your code
hub / github.com/TeaCoder52/patcode / isModeCompatible

Function isModeCompatible

src/profile.ts:45–63  ·  view source on GitHub ↗
(
	code: string,
	options: GenerateOptions
)

Source from the content-addressed store, hash-verified

43}
44
45export function isModeCompatible(
46 code: string,
47 options: GenerateOptions
48): boolean {
49 const mode: SecurityMode = options.mode ?? 'normal'
50 if (mode === 'normal') return true
51
52 const a = analyze(code)
53
54 if (isAllSame(code)) return false
55 if (isTooSimpleSequence(code)) return false
56 if (hasRepeats(code)) return false
57 if (a.isSequentialAsc || a.isSequentialDesc) return false
58
59 if (a.length === 4 && a.entropy < 6.5) return false
60 if (a.length === 6 && a.entropy < 10) return false
61
62 return true
63}
64
65export function isPredictionCompatible(
66 code: string,

Callers 1

isCodeAllowedFunction · 0.90

Calls 4

analyzeFunction · 0.90
isAllSameFunction · 0.90
isTooSimpleSequenceFunction · 0.90
hasRepeatsFunction · 0.85

Tested by

no test coverage detected