(
code: string,
options: GenerateOptions = {}
)
| 7 | } from './profile' |
| 8 | |
| 9 | export 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 | } |
no test coverage detected