Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const execFns = async (fns) => {
for (const [idx, f] of enumerate(fns)) {
const ident = `#${String(idx).padStart(2, '0')}/${f.alias}`;
// skip if error and no error handler (or no error and error handler)
if ((!context.error) === (!!f.errorHandler)) {
logger.silly(`skip ${ident}`, {
function: f.alias,
});
// eslint-disable-next-line no-continue
continue;
}
try {
await execTaps(enumerate(this._taps), f.title, idx);
} catch (e) {
if (!context.error) {
context.error = e;
}
}
if (context.error && !f.errorHandler) {
// eslint-disable-next-line no-continue
continue;
}
try {
logger.silly(`exec ${ident}`, {
function: f.alias,
});
await f(context, this._action);
} catch (e) {
logger.error(`Exception during ${ident}:\n${e.stack}`);
const execFns = async (fns) => {
for (const [idx, f] of enumerate(fns)) {
const ident = `#${String(idx).padStart(2, '0')}/${f.alias}`;
// skip if error and no error handler (or no error and error handler)
if ((!context.error) === (!!f.errorHandler)) {
logger.silly(`skip ${ident}`, {
function: f.alias,
});
// eslint-disable-next-line no-continue
continue;
}
try {
await execTaps(enumerate(this._taps), f.title, idx);
} catch (e) {
if (!context.error) {
context.error = e;
'Found ambigous frontmatter block: Block contains valid yaml, but '
+ `it's data type is ${type(data)} instead of Object.`
+ 'Make sure your yaml blocks contain only key-value pairs at the root level!');
}
return {
type: 'frontmatter',
payload: data,
start: fst.idx,
end: last.idx,
};
});
// Preprocessing
return pipe(
enumerate(mdast.children),
// Find any potential frontmatter starts/ends in the mdast
/* eslint-disable-next-line no-unused-vars */
filter(([idx, nod]) => isPotential(nod)),
// Filter out dom nodes based on their actual text content;
// this filters out HRs made from other characters or setext
// headings with more than three dashes...
//
// And: Perform some more sophisticated feature extraction on the nodes
map(([idx, nod]) => {
const mat = nodeStr(idx).match(re(`(?<=^|\\n)---${hspace}*\\n?$`));
if (!mat) {
return null;
}
// Offset of the actual separator line (this may deviate from the)
const offStart = mat.index + start(idx);
const offEnd = offStart + size(mat[0]);