UNPKG

@putout/engine-runner

Version:
16 lines (12 loc) 554 B
const isFn = (a) => typeof a === 'function'; const {stringify} = JSON; const {isArray} = Array; export const validate = (name, fn) => { if (name === 'include-items') { if (!isArray(fn)) throw Error(`☝️ Looks like 'include' does not return an 'array'. More on using Includer: https://git.io/JqcMn`); return; } if (!isFn(fn)) throw Error(`☝️ Looks like '${name}' is not a 'function' but '${typeof fn}' with value: '${stringify(fn)}'. More on using Includer: https://git.io/JqcMn`); };