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


TypeScript underscore.isArray函數代碼示例

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


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

示例1: function

        return _.filter(filters, function (f:Filter) {
            f.multi = _.isArray(f.value);
            // If multi-logic undefined - use Or
            f.multiLogic = undefined === f.multiLogic ? FilterMultiLogic.Or : f.multiLogic;

            return !(f.multi ? f.value.length === 0 : (f.value === '' || f.value === undefined));
        });
開發者ID:it7-solutions,項目名稱:networking-public-plugin,代碼行數:7,代碼來源:participants-list.component.ts

示例2: convert

    convert(content: string): string {
        let jsonContent = JSON.parse(content);

        if (_.isArray(jsonContent)) {
            return this.convertObjectToTsInterfaces(jsonContent[0]);
        }

        return this.convertObjectToTsInterfaces(jsonContent);
    }
開發者ID:lafe,項目名稱:VSCode-json2ts,代碼行數:9,代碼來源:Json2Ts.ts

示例3: convertJavaScriptToVariant

export function convertJavaScriptToVariant(
  argumentDefinition: ArgumentOptions[],
  values: any[]
): Variant[] {

    assert(argumentDefinition.length === values.length);
    assert(_.isArray(argumentDefinition));
    assert(_.isArray(values));

    return _.zip(values, argumentDefinition).map((pair: any) => {
        pair = pair as [VariantLike, Argument];
        const value = pair[0];
        const arg = pair[1];
        const variant = _.extend({}, arg);
        variant.value = value;
        return new Variant(variant);
    });
}
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:18,代碼來源:argument_list.ts

示例4: coerceByteString

export function coerceByteString(value: any): ByteString {
    if (_.isArray(value)) {
        return Buffer.from(value);
    }
    if (typeof value === "string") {
        return Buffer.from(value, "base64");
    }
    return value;
}
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:9,代碼來源:byte_string.ts

示例5: eachResult

export async function eachResult(result, cb) {
  if (_.isArray(result)) {
    for (let i in result) {
      await cb(result[i], i);
    }
  } else {
    await cb(result, 0);
  }
}
開發者ID:yedf,項目名稱:wx-rest,代碼行數:9,代碼來源:util2.ts

示例6: serializeParameter

    private static serializeParameter(val: any): string {
        if (_.isObject(val) ||
            _.isArray(val))
        {
            return JSON.stringify(val);
        }

        return val;
    }
開發者ID:pumlhorse,項目名稱:pumlhorse,代碼行數:9,代碼來源:assert.ts

示例7: output

  public output(section: GenericValueOutputType): ITableDataSource {
    if (isArray(section)) {
      return this.arrayJoined(section);
    }
    if (isObject(section)) {
      return this.objectJoined(section as Record<string, any>);
    }

    return this.simpleValue(section as string | number | undefined);
  }
開發者ID:coveo,項目名稱:search-ui,代碼行數:10,代碼來源:GenericValueOutput.ts

示例8: normalizeConnections

 private static normalizeConnections(data: any, id: number): Connection[] {
     if(data && data.connections && _.isArray(data.connections)){
         return _.each(data.connections, (raw: Connection) => {
             var isIncoming = raw.requested_id === id;
             raw._participant_id = isIncoming ?  raw.registration_id : raw.requested_id;
             return raw;
         }) as Connection[];
     } else {
         return [];
     }
 }
開發者ID:it7-solutions,項目名稱:networking-public-plugin,代碼行數:11,代碼來源:data-manager.service.ts

示例9: normalizeParticipants

 private static normalizeParticipants(data: any, searchField: string): Participant[] {
     if(data && data.participant && _.isArray(data.participant)){
         return _.each(data.participant, (raw:Participant) => {
             var v = raw[searchField];
             raw._search = typeof v == 'string' ? v.toLowerCase() : '';
             return raw;
         }) as Participant[];
     } else {
         return [];
     }
 }
開發者ID:it7-solutions,項目名稱:networking-public-plugin,代碼行數:11,代碼來源:data-manager.service.ts

示例10:

 _.find(haystack, (childHaystack) => {
   if (childHaystack.hasOwnProperty(needle) && childHaystack[needle] === value) {
     ret = childHaystack;
     return true;
   }
   if (_.isObject(childHaystack) || _.isArray(childHaystack)) {
     ret = this.findDeep(childHaystack, needle, value);
     if (ret != null) {
       return true;
     }
   }
 });
開發者ID:davidstellini,項目名稱:generator-tsdatalayer,代碼行數:12,代碼來源:TypeHandler.ts


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