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

Function isCodeAllowed

src/validator.ts:9–27  ·  view source on GitHub ↗
(
	code: string,
	options: GenerateOptions = {}
)

Source from the content-addressed store, hash-verified

7} from './profile'
8
9export function isCodeAllowed(
10 code: string,
11 options: GenerateOptions = {}
12): boolean {
13 const avoidSimple = options.avoidSimpleSequences !== false
14 const avoidAllSame = options.avoidSameDigits !== false
15
16 if (options.blackList?.includes(code)) return false
17 if (options.previousCode && options.previousCode === code) return false
18
19 if (avoidAllSame && isAllSame(code)) return false
20 if (avoidSimple && isTooSimpleSequence(code)) return false
21
22 if (!isProfileCompatible(code, options)) return false
23 if (!isModeCompatible(code, options)) return false
24 if (!isPredictionCompatible(code, options)) return false
25
26 return true
27}

Callers 4

validator.test.tsFile · 0.90
generateCodeFunction · 0.90
generateBankingCodeFunction · 0.90
isHumanFriendlyFunction · 0.90

Calls 5

isAllSameFunction · 0.90
isTooSimpleSequenceFunction · 0.90
isProfileCompatibleFunction · 0.90
isModeCompatibleFunction · 0.90
isPredictionCompatibleFunction · 0.90

Tested by

no test coverage detected