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

Function _resolveObjectOption

src/purify.ts:223–230  ·  view source on GitHub ↗
(
  cfg: Config,
  key: keyof Config,
  fallback: T
)

Source from the content-addressed store, hash-verified

221 * @returns a prototype-free clone of cfg[key], or the fallback
222 */
223const _resolveObjectOption = function <T extends Record<string, any>>(
224 cfg: Config,
225 key: keyof Config,
226 fallback: T
227): T {
228 const value = objectHasOwnProperty(cfg, key) ? cfg[key] : undefined;
229 return value && typeof value === 'object' ? clone(value as T) : fallback;
230};
231
232function createDOMPurify(window: WindowLike = getGlobal()): DOMPurify {
233 const DOMPurify: DOMPurify = (root: WindowLike) => createDOMPurify(root);

Callers 1

_parseConfigFunction · 0.85

Calls 1

cloneFunction · 0.85

Tested by

no test coverage detected