• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript circular-json.stringify函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中circular-json.stringify函数的典型用法代码示例。如果您正苦于以下问题:TypeScript stringify函数的具体用法?TypeScript stringify怎么用?TypeScript stringify使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了stringify函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: computeData

  function computeData(data) {
    if (data && util.isObject(data)) {
      if (data instanceof Error) {
        data = { message: data.message, error: data.stack };
      }
      if (typeof(data.toLogObj) === 'function') {
        return CircularJSON.stringify(snipsecret(data.toLogObj()));
      } else {
        return CircularJSON.stringify(snipsecret(data));
      }

    } else {
      return data;
    }
  }
开发者ID:RiseVision,项目名称:rise-node,代码行数:15,代码来源:logger.ts


示例2: __beforeEach

        /**
         * Automatically triggered before each called method.
         * Allow to execute some code that will be executed by all methods of all controllers.
         *
         * @param req       Request.
         * @param res       Response.
         * @param callback  Function to execute.
         * @param options   Object that contains options.
         * @private
         */
        private __beforeEach(req, res, callback: any, options: any = {}){
            // Default user.
            if(!req.session.user){
                req.session.user = {
                    // Ensure that we always know if the user is logged in or not and what is default access is.
                    connected: false,
                };
            }

            // Add debug information.
            // TODO Use express middleware instead...
            console.log('-------------------- start -------------------', 'debug');
            console.log('Url: ' + req.method + ' ' + req.baseUrl + req._parsedUrl.href, 'debug');

            if(!_.isEmpty(req.body)){
                console.log('Parameters: ' + JSON.stringify(req.body), 'debug');
            }

            console.log('Options: ' + CircularJSON.stringify(options), 'debug');
            console.log('Route: ' + req.route.method + ' => ' + req.path + ' (' + req.route.regexp + ')', 'debug');

            if(typeof req.headers.cookie !== "undefined"){
                console.log('Cookies: ' + req.headers.cookie, 'debug');
            }

            if(typeof req.headers['user-agent'] !== "undefined"){
                console.log('User agent: ' + req.headers['user-agent'], 'debug');
            }

            console.log('Session: ' + JSON.stringify(req.session), 'debug');
            console.log('---------------------------------------', 'debug');

            // Once we have done the stuff common to all methods, execute the actual callback.
            callback(req, res, options);
        }
开发者ID:OmarCastro,项目名称:ShellHive,代码行数:45,代码来源:CoreController.ts


示例3: function

    descriptor.value = function (...args: any[]) {
      if (_.isNil(this) || _.isNil(this.action)) {
        return originalMethod.apply(this, args);
      }
      let action = !_.isNil(this.action) ? this.action : this.dynamicComponent.inputs['action'];
      let result = undefined;
      const data = getLocalData();
      const code = getLangCode(data);
      const group = getGroup(groups, data); // session.User;
      const acl = getAcl(acls, data);

      langFile = _.find(langFiles, { code: code })['file'];
      if (isAdminUser(group, acl)) {
        // call function if access is granted
        result = originalMethod.apply(this, args);
      } else {
        if (canExecuteAction(group, group.Acl, action)) {
          result = originalMethod.apply(this, args);
        } else {
          showWarning(langFile['WarnInsufficientRights'], langFile['Error']);
        }
      }
      console.log(`Calling: ${fn}(${args}) => ${json.stringify(result)}`);
      return result;
    };
开发者ID:asiddeen,项目名称:BiB,代码行数:25,代码来源:authorized.decorator.ts


示例4:

 .map(object => CircularJSON.stringify(object));
开发者ID:whitecolor,项目名称:cyclejs,代码行数:1,代码来源:graphSerializer.ts


示例5: setObject

 public setObject(key: string, value: any): void {
   this.localStorage[key] = circularJson.stringify(value);
 }
开发者ID:asiddeen,项目名称:BiB,代码行数:3,代码来源:localstorage.service.ts


示例6: debugLogWrap

 descriptor.value = function debugLogWrap(...args) {
   const now = Date.now();
   console.log(`-> ${this.constructor.name}.${method} with ${args.length} args -> ${CircularJSON.stringify(args)}`);
   const toRet = old.apply(this, args);
   if (toRet instanceof Promise) {
     return toRet
       .then((res) => {
         console.log(`<- ${this.constructor.name}.${method} in ${Date.now() - now} with Promise(${CircularJSON.stringify(res)})`);
         return res;
       })
       .catch((err) => {
         let theErrMessage: string = err;
         if (err instanceof Error) {
           theErrMessage = err.message;
         }
         console.log(`<- ${this.constructor.name}.${method} in ${Date.now() - now} with Promise.reject('${theErrMessage}')`);
         return Promise.reject(err);
       });
   } else {
     console.log(`<- ${this.constructor.name}.${method} in ${Date.now() - now} with ${CircularJSON.stringify(toRet)}`);
     return toRet;
   }
 };
开发者ID:RiseVision,项目名称:rise-node,代码行数:23,代码来源:debugLog.ts


示例7: Promise

 .then((res) => {
   console.log(`<- ${this.constructor.name}.${method} in ${Date.now() - now} with Promise(${CircularJSON.stringify(res)})`);
   return res;
 })
开发者ID:RiseVision,项目名称:rise-node,代码行数:4,代码来源:debugLog.ts


示例8: objectToJson

 static objectToJson(val): string {
     enforce(val).isNotNull();
     return circularJson.stringify(val);
 }
开发者ID:pumlhorse,项目名称:pumlhorse,代码行数:4,代码来源:json.ts



注:本文中的circular-json.stringify函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript cjson.load函数代码示例发布时间:2022-05-24
下一篇:
TypeScript circular-json.parse函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap