當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript lodash.escape函數代碼示例

本文整理匯總了TypeScript中lodash.escape函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript escape函數的具體用法?TypeScript escape怎麽用?TypeScript escape使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了escape函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getMessageType

 messages.forEach(function(message) {
     const type = (message as any).fatal ? "error" : "failure";
     output += '<testcase time="0" name="org.eslint.' + (message.ruleId || "unknown") + '">';
     output += "<" + type + ' message="' + lodash.escape(message.message || "") + '">';
     output += "<![CDATA[";
     output += "line " + (message.line || 0) + ", col ";
     output += (message.column || 0) + ", " + getMessageType(message);
     output += " - " + lodash.escape(message.message || "");
     output += message.ruleId ? " (" + message.ruleId + ")" : "";
     output += "]]>";
     output += "</" + type + ">";
     output += "</testcase>\n";
 });
開發者ID:textlint,項目名稱:textlint,代碼行數:13,代碼來源:junit.ts

示例2: render

function render(token:Token, options:Options) : string {
  if(token instanceof FormulaToken) return renderFormula(token, options)
  if(token instanceof LinkToken)    return renderLink(token, options)
  if(token instanceof FormatToken)  return token.children.map(child => render(child, options)).join('') 
  if(token instanceof StrToken)     return _.escape(token.str || '')
  return ''
}
開發者ID:TrystalNet,項目名稱:trystup,代碼行數:7,代碼來源:render-text.ts

示例3: render

function render(token:Token, options:Options) : string {
  if(token instanceof FormulaToken) return renderFormula(token, options)
  if(token instanceof LinkToken)    return renderLink(token, options)
  if(token instanceof FormatToken)  return renderFormat(token, options)
  if(token instanceof StrToken)     return _.escape(token.str || '')
  return ''
}
開發者ID:TrystalNet,項目名稱:trystup,代碼行數:7,代碼來源:render-html.ts

示例4: renderCell

  renderCell(columnIndex, value, addWidthHack = false, rowLink = '') {
    value = this.formatColumnValue(columnIndex, value);

    if (value !== undefined) {
      value = _.escape(value);
    }

    var style = this.compileStyles();

    // because of the fixed table headers css only solution
    // there is an issue if header cell is wider the cell
    // this hack adds header content to cell (not visible)
    var widthHack = '';
    if (addWidthHack) {
      widthHack = '<div class="table-panel-width-hack">' + this.table.columns[columnIndex].text + '</div>';
    }

    if (value === undefined) {
      style = ' style="display:none;"';
      this.table.columns[columnIndex].hidden = true;
    } else {
      this.table.columns[columnIndex].hidden = false;
      if (rowLink !== '') {
        value = '<a href="' + rowLink + '" target="_new">' + value + '</a>';
      }
    }

    return '<td' + style + ' align="' + this.alignState + '">' + value + widthHack + '</td>';
  }
開發者ID:madshall,項目名稱:grafana,代碼行數:29,代碼來源:renderer.ts

示例5: render

  render(page) {
    let pageSize = this.panel.pageSize || 100;
    let startPos = page * pageSize;
    let endPos = Math.min(startPos + pageSize, this.table.rows.length);
    var html = "";

    for (var y = startPos; y < endPos; y++) {
      let row = this.table.rows[y];
      let cellHtml = '';
      let rowStyle = '';
      let rowLink = this.panel.rowLink;

      if (rowLink) {
        for (var i = 0; i < this.table.columns.length; i++) {
          rowLink = rowLink.replace('$' + this.table.columns[i].text, _.escape(row[i]));
        }
      }

      for (var i = 0; i < this.table.columns.length; i++) {
        cellHtml += this.renderCell(i, row[i], y === startPos, rowLink);
      }

      if (this.colorState.row) {
        rowStyle = ' style="background-color:' + this.colorState.row + ';color: white"';
        this.colorState.row = null;
      }

      html += '<tr ' + rowStyle + '>' + cellHtml + '</tr>';
    }

    return html;
  }
開發者ID:madshall,項目名稱:grafana,代碼行數:32,代碼來源:renderer.ts

示例6: emitCompileViewError

export function emitCompileViewError( content: string, err: TypeError, filename: string ) : relaxjs.RxError {
  var errTitle = '[error] Compiling View: %s'+ filename ;
  var errMsg = err.message;
  var code =  format('<h4>Content being compiled</h4><pre>{0}</pre>', _.escape(content));
  _log.error(errTitle);
  return new relaxjs.RxError(errMsg, errTitle, 500, code );
}
開發者ID:micurs,項目名稱:relaxjs,代碼行數:7,代碼來源:internals.ts

示例7: renderCell

  renderCell(columnIndex, value, addWidthHack = false) {
    value = this.formatColumnValue(columnIndex, value);
    value = _.escape(value);
    var style = '';
    if (this.colorState.cell) {
      style = ' style="background-color:' + this.colorState.cell + ';color: white"';
      this.colorState.cell = null;
    } else if (this.colorState.value) {
      style = ' style="color:' + this.colorState.value + '"';
      this.colorState.value = null;
    }

    // because of the fixed table headers css only solution
    // there is an issue if header cell is wider the cell
    // this hack adds header content to cell (not visible)
    var widthHack = '';
    if (addWidthHack) {
      widthHack = '<div class="table-panel-width-hack">' + this.table.columns[columnIndex].text + '</div>';
    }

    if (value.indexOf("http") > -1) {
      return '<td' + style + '><a href=\"' + value + '\" target=\"_blank\">' + value + widthHack + '</a></td>';
    } else {
      return '<td' + style + '>' + value + widthHack + '</td>';
    }
  }
開發者ID:smur89,項目名稱:grafana,代碼行數:26,代碼來源:renderer.ts

示例8: renderCell

  renderCell(columnIndex, value, addWidthHack = false) {
    value = this.formatColumnValue(columnIndex, value);

    if (value !== undefined) {
      value = _.escape(value);
    }

    var style = '';
    if (this.colorState.cell) {
      style = ' style="background-color:' + this.colorState.cell + ';color: white"';
      this.colorState.cell = null;
    } else if (this.colorState.value) {
      style = ' style="color:' + this.colorState.value + '"';
      this.colorState.value = null;
    }

    // because of the fixed table headers css only solution
    // there is an issue if header cell is wider the cell
    // this hack adds header content to cell (not visible)
    var widthHack = '';
    if (addWidthHack) {
      widthHack = '<div class="table-panel-width-hack">' + this.table.columns[columnIndex].text + '</div>';
    }

    if (value === undefined) {
      style = ' style="display:none;"';
      this.table.columns[columnIndex].hidden = true;
    } else {
      this.table.columns[columnIndex].hidden = false;
    }

    return '<td' + style + '>' + value + widthHack + '</td>';
  }
開發者ID:madshall,項目名稱:grafana-custom,代碼行數:33,代碼來源:renderer.ts

示例9: sanitizeString

 function sanitizeString(str) {
   try {
     return $sanitize(str);
   } catch (err) {
     console.log('Could not sanitize annotation string, html escaping instead');
     return _.escape(str);
   }
 }
開發者ID:ArcticSnowman,項目名稱:grafana,代碼行數:8,代碼來源:annotation_tooltip.ts

示例10: callback

            $scope.handleEvent({ $event: { name: 'get-param-options', param: param } }).then((result: any) => {
              const dynamicOptions = _.map(result, op => {
                return _.escape(op.value);
              });

              // add current value to dropdown if it's not in dynamicOptions
              if (_.indexOf(dynamicOptions, part.params[paramIndex]) === -1) {
                dynamicOptions.unshift(_.escape(part.params[paramIndex]));
              }

              callback(dynamicOptions);
            });
開發者ID:grafana,項目名稱:grafana,代碼行數:12,代碼來源:sql_part_editor.ts


注:本文中的lodash.escape函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。