Escape RegExp special characters in strings for safe use in regular expressions
Overall
score
100%
Evaluation — 100%
↑ 1.00xAgent success when using this tile
{
"context": "This criteria evaluates how well the engineer uses the escape-string-regexp package to implement type-safe pattern creation. It focuses on proper input validation with TypeError throwing and correct usage of the package's escaping functionality.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Type validation implementation",
"description": "Checks if the input is a string using typeof or similar mechanism before processing. This validation should occur before calling the escape-string-regexp function.",
"max_score": 25
},
{
"name": "TypeError for invalid inputs",
"description": "Throws a TypeError (not just Error) when the input is not a string (null, undefined, number, object, etc.). The error type must specifically be TypeError to match the package's behavior.",
"max_score": 25
},
{
"name": "Using escape-string-regexp",
"description": "Imports and calls the escape-string-regexp package (or escapeStringRegexp function) to escape special regex characters. Must actually use the package rather than implementing custom escaping logic.",
"max_score": 30
},
{
"name": "Correct return value",
"description": "Returns the escaped string from escape-string-regexp directly without unnecessary modifications. The return value should be the result of calling the escape-string-regexp function on the validated input.",
"max_score": 20
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-escape-string-regexp@5.0.0