UNPKG

suitest-js-api

Version:

Suitest is a test automation and device manipulation tool for living room devices and web browsers.

19 lines (15 loc) 332 B
/** * Converts function, provided by user to string. * Validates input. * @param {String|Function} input * @returns {string|null} */ function parseJS(input) { if (typeof input === 'string') { return input; } if (typeof input !== 'function') return null; return `(${input.toString()})()`; } module.exports = parseJS;