Build a module that scans user-submitted text for crisis language and surfaces appropriate resources — without ever blocking the user's ability to post.
scanContent(text: string): SafetyCheckResult
// SafetyCheckResult: {
// flagged: boolean,
// severity: 'low' | 'medium' | 'high',
// matchedPatterns: string[],
// suggestedResources: Resource[]
// }
// Resource: { name: string, contact: string, url: string, available24h: boolean }
Requirements:
\b). The list should be maintainable (exported constant), not buried in logic.Write tests for: high-severity match, low-severity match, false positive guard ("shoot, I forgot", "I'm dying laughing"), clean content returning flagged: false.
No contributions yet.