Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/sxzz/chrome-extension-template.
Something went wrong. Try again.
12345678910111213141516import _ from 'lodash';
export const getFunction = path => { const prop = path.join('.'); let fun = _.get(chrome, prop); if (!fun || typeof fun !== 'function') { throw new Error(`"${prop}" is not a function, instead ${typeof fun}.`); }
path.pop(); const scope = _.get(chrome, path.join('.')); fun = fun.bind(scope);
return { fun, scope };};