UNPKG

314 BJavaScriptView Raw
1const logger = require('../app/Logger')
2
3module.exports = (str) => {
4 try {
5 const script = ` "use strict"; return (${str})`
6 return Function(script)()
7 }catch(e) {
8 logger.error(`Fail of transforming string into javascript: ${e.message}\r\n${e.stack}`)
9 throw e
10 }
11}
\No newline at end of file