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

Function isProfileCompatible

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

Source from the content-addressed store, hash-verified

8}
9
10export function isProfileCompatible(
11 code: string,
12 options: GenerateOptions
13): boolean {
14 const profile: HumanProfile = options.profile ?? 'default'
15 const analysis = analyze(code)
16 const prediction = predictCodeQuality(code, options)
17
18 switch (profile) {
19 case 'children': {
20 if (analysis.memorability === 'low') return false
21 if (prediction.memorabilityScore < 0.6) return false
22 if (analysis.isSequentialAsc || analysis.isSequentialDesc)
23 return false
24 return true
25 }
26 case 'elderly': {
27 if (analysis.memorability === 'low') return false
28 if (analysis.entropy > 11 && analysis.length === 6) return false
29 return true
30 }
31 case 'asia': {
32 if (code.includes('4')) return false
33 return true
34 }
35 case 'latam': {
36 if (code[0] === '0' || code[0] === '1') return false
37 return true
38 }
39 case 'default':
40 default:
41 return true
42 }
43}
44
45export function isModeCompatible(
46 code: string,

Callers 1

isCodeAllowedFunction · 0.90

Calls 2

analyzeFunction · 0.90
predictCodeQualityFunction · 0.90

Tested by

no test coverage detected