function assertIsFunction(str) {
  let isFunction;

  try {
    isFunction = isFunctionDeclaration(str) && Function(`return typeof (${str})`)() === 'function';
  } catch (e) {
    isFunction = false;
  }

  if (!isFunction) {
    throw new TypeError(`Expected a valid function string, but got: ${str}\n\n${EXAMPLE}`);
  }

  return str;
}
Dynamically evaluates a string as a function and throws an error if it's not a function
@param {string} str serialized function like 'function() { return 42; }'