'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
/**
 * Created by baoyinghai on 11/10/16.
 */

var evil = function evil(fn) {
  var Fn = Function; // 一个变量指向Function，防止有些前端编译工具报错
  return new Fn('return ' + fn.replace(/(^\s*)|(\s*$)/g, ''))();
};

var executeJS = function executeJS(str) {
  var strSq = str.split(/({|})/);
  var jsStr = '(function(){' + strSq.slice(2, strSq.length - 2)[0] + 'return itemVar;})()';
  var result = evil(jsStr);
  return result;
};

var createFunc = exports.createFunc = evil;

exports.default = executeJS;