server/helpers/customCode.js
function render(rawCode, idPre) {
  var codeArr = {};

  // get js that is a src ref
  // TODO: need to check for `async` OR `defer` prop
  var re = /<script[^>]* src\s*=\s*'*"*([^'"]+)[^>]*>.*<\/script>/gi;
  var HeaderCode = re.exec(rawCode);
  if (HeaderCode) {
    _.forEach(HeaderCode, function(code, key) {
      if (0 === key) return;
      codeArr[`${idPre}-src-${key}`] = code;
    });
  }

  // get js that is code
  re = /<script[^>]*>([^]+)<\/script>/gi;
  HeaderCode = re.exec(rawCode);
  if (HeaderCode) {
    _.forEach(HeaderCode, function(code, key) {
      if (0 === key) return;
      codeArr[`${idPre}-js-${key}`] = {code: code};
    });
  }

  return codeArr;
}
function render(rawCode, idPre) {
  var codeArr = {};

  // get js that is a src ref
  // TODO: need to check for `async` OR `defer` prop
  var re = /<script[^>]* src\s*=\s*'*"*([^'"]+)[^>]*>.*<\/script>/gi;
  var HeaderCode = re.exec(rawCode);
  if (HeaderCode) {
    _.forEach(HeaderCode, function(code, key) {
      if (0 === key) return;
      codeArr[`${idPre}-src-${key}`] = code;
    });
  }

  // get js that is code
  re = /<script[^>]*>([^]+)<\/script>/gi;
  HeaderCode = re.exec(rawCode);
  if (HeaderCode) {
    _.forEach(HeaderCode, function(code, key) {
      if (0 === key) return;
      codeArr[`${idPre}-js-${key}`] = {code: code};
    });
  }

  return codeArr;
}
render string into array of js code and js src