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


TypeScript lodash.isarray類代碼示例

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


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

示例1: catch

 public static each<T>(argu0: any, callback: (argu1: any, argu2: any) => any): any {
   try {
     if (isArray(argu0) || argu0 instanceof J3Object) { // TODO pnly: check array like object
       Array.prototype.forEach.call(argu0, (value: any, indexInArray: number) => {
         const ret = callback.bind(value)(indexInArray, value);
         if (ret === false) {
           throw BreakException;
         }
       });
     } else {
       Object.keys(argu0).forEach((propertyName: string, index: number) => {
         const valueOfProperty = argu0[propertyName];
         const ret = callback.bind(valueOfProperty)(propertyName, valueOfProperty);
         if (ret === false) {
           throw BreakException;
         }
       });
     }
   } catch (e) {
     if (e !== BreakException) {
       throw e;
     }
   }
   return argu0;
 }
開發者ID:kyasbal-1994,項目名稱:jThree,代碼行數:25,代碼來源:Utilities.ts

示例2: ServiceProfile

        getProfile(): ServiceProfile{
            var profile = this.getProperty('profile');

            if (_isArray(profile)){
                return new ServiceProfile(profile[0]);
            }

            return new ServiceProfile(profile);
        }
開發者ID:digsc,項目名稱:manifesto,代碼行數:9,代碼來源:Service.ts

示例3: _forVectorarray

 private static _forVectorarray(dimension: number, uniform: IVariableDescription): void {
   const defaultArray = VectorArray.zeroVectorArray(dimension, uniform.arrayLength);
   const defaultValue = uniform.variableAnnotation.default;
   if (defaultArray) {
     if (isArray(defaultValue)) {
       if (isArray(defaultValue[0])) {
         for (let i = 0; i < defaultValue.length; i++) {
           defaultArray.setRawArray(i, defaultValue[i]);
         }
       } else {
         for (let i = 0; i < defaultValue.length; i++) {
           defaultArray.rawElements[i] = defaultValue[i];
         }
       }
     } else {
       throw new Error(`Unknown default value '${defaultValue}' was specified for variable '${uniform.variableType}[] ${uniform.variableName}'`);
     }
   }
   uniform.variableAnnotation.default = defaultArray;
 }
開發者ID:kyasbal-1994,項目名稱:jThree,代碼行數:20,代碼來源:DefaultValuePreProcessor.ts

示例4: _forMat4Array

 private static _forMat4Array(uniform: IVariableDescription): void {
   const defaultValue = uniform.variableAnnotation.default;
   uniform.variableAnnotation.default = MatrixArray.getIdentityMatrixArray(uniform.arrayLength);
   if (defaultValue) {
     if (isArray(defaultValue)) {
       for (let i = 0; i < defaultValue.length; i++) {
         uniform.variableAnnotation.default.rawElements[i] = defaultValue[i];
       }
     }
   }
 }
開發者ID:kyasbal-1994,項目名稱:jThree,代碼行數:11,代碼來源:DefaultValuePreProcessor.ts

示例5: ServiceProfile

        getProfile(): ServiceProfile{
            var profile = this.getProperty('profile');

            if (!profile) {
                profile = this.getProperty('dcterms:conformsTo');
            }

            if (_isArray(profile)){
                return new ServiceProfile(profile[0]);
            }

            return new ServiceProfile(profile);
        }
開發者ID:tomcrane,項目名稱:manifesto,代碼行數:13,代碼來源:Service.ts

示例6: 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


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