MCPcopy Create free account
hub / github.com/cure53/DOMPurify / isRegex

Function isRegex

src/utils.ts:338–350  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

336}
337
338function isRegex(value: unknown): value is RegExp {
339 // Skip the try for absent values: a thrown TypeError is slow
340 if (!value) {
341 return false;
342 }
343
344 try {
345 regExpTest(value as RegExp, '');
346 return true;
347 } catch {
348 return false;
349 }
350}
351
352export {
353 // Array

Callers 1

_parseConfigFunction · 0.85

Calls 1

regExpTestFunction · 0.85

Tested by

no test coverage detected