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


TypeScript json-stringify-safe.default函數代碼示例

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


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

示例1: handleObjectData

function handleObjectData(param, level: Level) {
    //#region @backend
    if (istartedInVscode()) {
        consoleLog(param, level);
        return;
    }
    let out = stringify(param, null, 4)
    out = replace(out, /\".*"\:\ \"/g, /\"\: "/, chalk.green);
    out = replace(out, /\".*"\:\ \{/g, /\"\: \{/, chalk.yellow);
    out = replace(out, /\".*"\:\ \[/g, /\"\: \[/, chalk.red);
    out = replace(out, /\".*"\:\ true/g, /\"\: true/, chalk.blue);
    out = replace(out, /\".*"\:\ false/g, /\"\: false/, chalk.blue);
    out = replace(out, /\".*"\:\ (\-|[0-9])/g, /\"\: (\-|[0-9])/, chalk.magenta);

    out = out.replace(/\"/g, chalk.dim('"'))
        .replace(/\{/g, chalk.dim('{'))
        .replace(/\}/g, chalk.dim('}'))
        .replace(/\}/g, chalk.dim('}'))

    if (process.stdout.columns && process.stdout.columns > 0) {
        out = out.split('\n').map(line => {
            return (line.length < process.stdout.columns ?
                line :
                line.slice(0, process.stdout.columns - 6) + chalk.dim('...'));
        }).join('\n');
    }
    consoleLog(out, level);
    //#endregion
}
開發者ID:darekf77,項目名稱:ng2-logger,代碼行數:29,代碼來源:backend-logging.ts

示例2: transform

 transform(value: any): any {
     var stringify = require('json-stringify-safe');
     var json = stringify(value);
     // console.log('stringified', json);
     if ( json ) {
       return JSON.parse(json);
     } else {
       return '';
     }
 }
開發者ID:fabiopavesi,項目名稱:EDI-NG_client,代碼行數:10,代碼來源:remove-cyclic.pipe.ts

示例3: setData

  setData(fields) {
    Object
      .keys(fields)
      .forEach(key => {
        this._data[key] = fields[key];
      });

    this._data.__lastUpdated = Date.now();
    // In page-bus, we must send non-identical data.
    // Otherwise, it'll cache and won't trigger.
    // That's why we are setting the __lastUpdated value here.
    this._bus.emit(this.getDataKey(), stringify(this.getData()));
    this._handlers.forEach(handler => handler(this.getData()));
  }
開發者ID:tycho01,項目名稱:react-storybook,代碼行數:14,代碼來源:synced_store.ts

示例4: stringify

 this.executeCmd(req.body.command, (err: any, result: any) => {
   if (err) {
     return res.send({ result: err.message || err });
   }
   let response = result;
   if (typeof result !== "string") {
     response = stringify(result, jsonFunctionReplacer, 2);
   } else {
     // Avoid HTML injection in the Cockpit
     response = escapeHtml(response);
   }
   const jsonResponse = {result: response};
   if (res.headersSent) {
     return res.end(jsonResponse);
   }
   return res.send(jsonResponse);
 });
開發者ID:iurimatias,項目名稱:embark-framework,代碼行數:17,代碼來源:index.ts

示例5: stringify

 .map(action => stringify(action, null, 2))
開發者ID:tycho01,項目名稱:react-storybook,代碼行數:1,代碼來源:layout.ts

示例6: jss

function jss(x: any) {
  return _jss(x, null, 2);
}
開發者ID:hyperkot,項目名稱:testnow,代碼行數:3,代碼來源:invoke.ts


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