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

TypeScript lodash.isstring类代码示例

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

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



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

示例1: isString

    exchange.declare((errInExchangeDeclare) => {
      if (errInExchangeDeclare) return done(errInExchangeDeclare);

      const queueOptions = this.getQueueOptions();
      const queue = connection.queue(queueOptions);
      const bindingKeys = !config.bindingKeys ? [""] :
        isString(config.bindingKeys) ? [config.bindingKeys] : config.bindingKeys;

      queue.declare(queueOptions, (errInQueueDeclare) => {
        if (errInQueueDeclare) return done(errInQueueDeclare);

        for (let bindingKey of bindingKeys) {
          queue.bind(config.channel, bindingKey, (errInQueueBind) => {
            if (errInQueueBind) return done(errInQueueBind);
            if (this.isClosed) return; // Skip if already closed

            if (consumer) {
              this.consumer.resume(done);
            } else {
              this.consumer = consumer = connection.consume(queueOptions.queue, clone(queueOptions), (envelope) => this.onMessage(envelope), done);
              consumer.on("error", (err) => this.onConsumerError(err));
            }
          });
        }
      });
    });
开发者ID:tcdl,项目名称:msb,代码行数:26,代码来源:subscriber.ts


示例2: function

export default function (options: any, payload: MessagePayload, cb: (err: Error, payload: MessagePayload, message: Message) => void): Requester {
  if (isString(options)) {
    options = {
      namespace: options,
      waitForResponses: 1,
    };
  } else if (!("waitForResponses" in options)) {
    options.waitForResponses = 1;
  }

  options = clone(options);

  const channelManager = options.channelManager;
  delete(options.channelManager);

  const originalMessage = options.originalMessage;
  delete(options.originalMessage);

  const responseSchema = options.responseSchema;
  delete(options.responseSchema);

  const requester = new Requester(options, originalMessage);
  let responsePayload: MessagePayload;
  let responseMessage: Message;

  let onResponseFn = function (payloadInResponseFn: MessagePayload, message: Message): void {
    responsePayload = payloadInResponseFn;
    responseMessage = message;
  };

  if (responseSchema) {
    onResponseFn = validateWithSchema.onEvent(responseSchema, onResponseFn);
  }

  if (channelManager) {
    requester.channelManager = channelManager;
  }

  requester
    .on("payload", onResponseFn)
    .once("error", cb)
    .once("end", (): void => {
      cb(null, responsePayload, responseMessage);
    });

  return requester.publish(payload);
};
开发者ID:tcdl,项目名称:msb,代码行数:47,代码来源:request.ts


示例3: on

 public on(argu0: any, argu1?: any, argu2?: any, argu3?: any): any {
   const eventData: IEventArgu = {
     events: {},
     data: null,
     selector: null,
   };
   let isEvents = false;
   const falseHandler: (eventObject: J3Event, ...extraParameter: any[]) => void = function(e) {
     e.preventDefault();
     e.stopPropagation();
   };
   switch (true) {
     case isString(argu0):
       eventData.events[argu0] = null;
       break;
     case isPlainObject(argu0):
       isEvents = true;
       eventData.events = argu0;
       break;
     default:
       throw new Error("Argument type is not correct");
   }
   switch (true) {
     case (isUndefined(argu1) && isEvents):
       break;
     case (isFunction(argu1) && !isEvents):
       eventData.events[argu0] = argu1;
       break;
     case (argu1 === false):
       eventData.events[argu1] = falseHandler;
       break;
     case isString(argu1):
       eventData.selector = argu1;
       switch (true) {
         case (isUndefined(argu2) && isEvents):
           break;
         case (isFunction(argu2) && !isEvents):
           eventData.events[argu0] = argu2;
           break;
         case (argu2 === false):
           eventData.events[argu2] = falseHandler;
           break;
         case isArray(argu2) || isPlainObject(argu2):
           eventData.data = argu2;
           switch (true) {
             case (isUndefined(argu3) && isEvents):
               break;
             case (isFunction(argu3) && !isEvents):
               eventData.events[argu0] = argu3;
               break;
             case (argu3 === false):
               eventData.events[argu3] = falseHandler;
               break;
             default:
               throw new Error("Argument type is not correct");
           }
           break;
         default:
           throw new Error("Argument type is not correct");
       }
       break;
     case isArray(argu1) || isPlainObject(argu1):
       eventData.data = argu1;
       switch (true) {
         case (isUndefined(argu2) && isEvents):
           break;
         case (isFunction(argu2) && !isEvents):
           eventData.events[argu0] = argu2;
           break;
         case (argu2 === false):
           eventData.events[argu2] = falseHandler;
           break;
         default:
           throw new Error("Argument type is not correct");
       }
       break;
     default:
       throw new Error("Argument type is not correct");
   }
   if (eventData.selector) {
     throw new Error("Not implemented yet");
   }
   Object.keys(eventData.events).forEach((eventTypeString) => {
     this.__getArray().forEach((node) => {
       let eventOrganizer = node.props.getProp<EventOrganizer>("event");
       if (!eventOrganizer) {
         eventOrganizer = new EventOrganizer(node);
         node.props.setProp("event", eventOrganizer);
       }
       eventOrganizer.capture(eventTypeString, eventData.events[eventTypeString], eventData.data);
     });
   });
   return this;
 }
开发者ID:kyasbal-1994,项目名称:jThree,代码行数:94,代码来源:EventHandlerAttachment.ts


示例4: off

 public off(argu0?: any, argu1?: any, argu2?: any): any {
   const eventData: IEventArgu = {
     events: {},
     data: null,
     selector: null,
   };
   let removeAll = false;
   let isEvents = false;
   switch (true) {
     case isUndefined(argu0):
       removeAll = true;
       break;
     case isString(argu0):
       eventData.events[argu0] = null;
       break;
     case isPlainObject(argu0):
       isEvents = true;
       eventData.events = argu0;
       break;
     default:
       throw new Error("Argument type is not correct");
   }
   switch (true) {
     case (removeAll):
     case (isUndefined(argu1) && isString(argu0)):
     case (isUndefined(argu1) && isEvents):
       break;
     case (isFunction(argu1) && !isEvents):
       eventData.events[argu0] = argu1;
       break;
     case isString(argu1):
       eventData.selector = argu1;
       switch (true) {
         case (isUndefined(argu2) && isEvents):
           break;
         case (isFunction(argu2) && !isEvents):
           eventData.events[argu0] = argu2;
           break;
         default:
           throw new Error("Argument type is not correct");
       }
       break;
     default:
       throw new Error("Argument type is not correct");
   }
   if (eventData.selector) {
     throw new Error("Not implemented yet");
   }
   if (removeAll) {
     this.__getArray().forEach((node) => {
       let eventOrganizer = node.props.getProp<EventOrganizer>("event");
       if (eventOrganizer) {
         eventOrganizer.releaseAll();
       }
     });
   } else {
     Object.keys(eventData.events).forEach((eventTypeString) => {
       this.__getArray().forEach((node) => {
         let eventOrganizer = node.props.getProp<EventOrganizer>("event");
         if (eventOrganizer) {
           if (eventData.events[eventTypeString]) {
             eventOrganizer.release(eventTypeString, eventData.events[eventTypeString]);
           } else {
             eventOrganizer.releaseAll(eventTypeString);
           }
         }
       });
     });
   }
 }
开发者ID:kyasbal-1994,项目名称:jThree,代码行数:70,代码来源:EventHandlerAttachment.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.isundefined类代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.isplainobject类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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