当前位置: 首页>>代码示例>>TypeScript>>正文


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

本文整理汇总了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;未经允许,请勿转载。