当前位置: 首页>>代码示例>>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;未经允许,请勿转载。