UNPKG

vincent-cli

Version:

基于vue全家桶的脚手架,主要包含webapp、一般网页的模板。

16 lines (13 loc) 399 B
const chalk = require('chalk') /** * 根据prompt结果,获取Meta .JSON中的表达式的结果的值。 */ module.exports = function evaluate (exp, data) { /* eslint-disable no-new-func */ const fn = new Function('data', 'with (data) { return ' + exp + '}') try { return fn(data) } catch (e) { console.error(chalk.red('Error when evaluating filter condition: ' + exp)) } }