Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mdast.children.splice(block.start + off, cnt, dat);
off += -cnt + 1; // cnt removed, 1 inserted
} else {
const { warning, source, start } = block;
const fst = mdast.children[start + off];
// This also needs to account for settext headings
// hence the usage of end here, instead of using start
const { line } = fst.position.end;
// Source file pretty printing with line numbers
const sourceref = pipe(
source.split('\n'),
zipLeast2(range(line, Infinity)),
map(([l, no]) => ` ${no} | ${l} `),
join('\n'),
);
const err = new FrontmatterParsingError(`${warning}\n${sourceref}`);
if (!production()) {
logger.warn(err);
}
logger.debug(err);
}
}
};
function key(context, { logger }) {
const cont = setdefault(context, 'content', {});
const res = setdefault(context, 'response', {});
const headers = setdefault(res, 'headers', {});
// somebody already set a surrogate key
if (headers['Surrogate-Key'] || !(type(cont.sources) === Array)) {
logger.debug('Keeping existing Surrogate-Key header');
return;
}
logger.debug('Setting Surrogate-Key header');
headers['Surrogate-Key'] = join(' ')(map(cont.sources, computeSurrogateKey));
}