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


TypeScript map.default函數代碼示例

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


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

示例1: mapCommonData

    private mapCommonData(args) {
        const
            scheduler = this._scheduler,
            data = scheduler.getData();

        return {
            _ok: 1,
            sim: scheduler.startedAt,
            rs: scheduler.startedAt,
            n: data.name,
            st: scheduler.status.code,
            je: scheduler.jobsExecuted,
            jt: data.jobsCount,
            ip: __map(scheduler.inProgress, ip => ip.fireInstanceId + '|' + ip.trigger.name),
            jg: __map(data.groups, g => ({
                n: g.name,
                s: g.getStatus().value,

                jb: __map(g.jobs, j => ({
                    n: j.name,
                    s: j.getStatus().value,
                    gn: g.name,
                    _: g.name + '_' + j.name,

                    tr: __map(j.triggers, t => ({
                        '_': t.name,
                        n: t.name,
                        s: t.getStatus().value,
                        sd: t.startDate,
                        ed: t.endDate,
                        nfd: t.nextFireDate,
                        pfd: t.previousFireDate,
                        tc: 'simple',
                        tb: (t.repeatCount === null ? '-1' : t.repeatCount.toString()) + '|' + t.repeatInterval + '|' + t.executedCount
                    }))
                }))
            })),
            ev: __map(
                scheduler.findEvents(+args.minEventId),
                ev => {
                    const result: any = {
                        '_': `${ev.id}|${ev.date}|${ev.eventType}|${ev.scope}`,
                        k: ev.itemKey,
                        fid: ev.fireInstanceId
                    };

                    if (ev.faulted) {
                        result['_err'] = ev.errors ?
                            __map(ev.errors, er => ({ "_": er.text, l: er.level })) :
                            1
                    }

                    return result;
                }
                    //`${ev.id}|${ev.date}|${ev.eventType}|${ev.scope}|${ev.fireInstanceId}|${ev.itemKey}`
            )
        };
    }
開發者ID:guryanovev,項目名稱:CrystalQuartz,代碼行數:58,代碼來源:fake-scheduler-server.ts

示例2: sortColorsByHue

function sortColorsByHue(hexColors: string[]) {
  const hslColors = map(hexColors, hexToHsl);

  const sortedHSLColors = sortBy(hslColors, ['h']);
  const chunkedHSLColors = chunk(sortedHSLColors, PALETTE_ROWS);
  const sortedChunkedHSLColors = map(chunkedHSLColors, chunk => {
    return sortBy(chunk, 'l');
  });
  const flattenedZippedSortedChunkedHSLColors = flattenDeep(zip(...sortedChunkedHSLColors));

  return map(flattenedZippedSortedChunkedHSLColors, hslToHex);
}
開發者ID:bergquist,項目名稱:grafana,代碼行數:12,代碼來源:colors.ts

示例3: mapProperties

function mapProperties(typeCode: string, data: any): Property[] {
    if (!data) {
        return null;
    }

    if (typeCode === 'enumerable') {
        return __map(data, (item, index) => new Property('[' + index + ']', mapPropertyValue(item)));
    } else if (typeCode === "object") {
        return __map(
            __keys(data),
            key => new Property(key, mapPropertyValue(data[key])));
    } else {
        throw new Error('Unknown type code ' + typeCode);
    }
}
開發者ID:guryanovev,項目名稱:CrystalQuartz,代碼行數:15,代碼來源:common-mappers.ts

示例4: sync

    sync(activities: TActivity[]) {
        const
            existingActivities: TActivityViewModel[] = this.list.getValue(),

            deletedActivities = __filter(
                existingActivities,
                viewModel => __every(activities, activity => this.areNotEqual(activity, viewModel))),

            addedActivities = __filter(
                activities,
                activity => __every(existingActivities, viewModel => this.areNotEqual(activity, viewModel))),

            updatedActivities = __filter(
                existingActivities,
                viewModel => __some<TActivity>(activities, activity => this.areEqual(activity, viewModel))),

            addedViewModels = __map(addedActivities, this.mapper),

            finder = (viewModel: TActivityViewModel) => __find(activities, activity => this.areEqual(activity, viewModel));

        __each(deletedActivities, viewModel => this.list.remove(viewModel));
        __each(addedViewModels, viewModel => {
            viewModel.updateFrom(finder(viewModel));
            this.list.add(viewModel);
        });
        __each(updatedActivities, viewModel => viewModel.updateFrom(finder(viewModel)));
    }
開發者ID:guryanovev,項目名稱:CrystalQuartz,代碼行數:27,代碼來源:activities-synschronizer.ts

示例5: mapTriggers

function mapTriggers(triggers): Trigger[] {
    if (!triggers) {
        return [];
    }

    return __map(triggers, mapSingleTrigger);
}
開發者ID:guryanovev,項目名稱:CrystalQuartz,代碼行數:7,代碼來源:common-mappers.ts

示例6: map

 .replace(/style="([^"]+)"+/g, (match, style)=> {
   let reactStyle = map(compact(style.split(";")), (keyvalue)=> {
     let [key, value] = keyvalue.split(":")
     return `${key}:"${value}"`
   }).join(",")
   return "style={{" + reactStyle + "}}"
 })
開發者ID:BenJamesbabala,項目名稱:searchkit,代碼行數:7,代碼來源:TestHelpers.ts

示例7:

                    (job: Job) => {
                        const flattenTriggers = __map(job.Triggers,
                            (t:Trigger) => ({ scope: SchedulerEventScope.Trigger, key: this.makeSlotKey(SchedulerEventScope.Trigger, t.UniqueTriggerKey), size: 1 }));

                        return [
                            { scope: SchedulerEventScope.Job, key: this.makeSlotKey(SchedulerEventScope.Job, jobGroup.Name) + '.' + job.Name, size: flattenTriggers.length + 1 }, // todo: fix key concatenation logic
                            ...flattenTriggers
                        ];
                    }
開發者ID:guryanovev,項目名稱:CrystalQuartz,代碼行數:9,代碼來源:global-activities-synchronizer.ts

示例8: mapJobGroups

function mapJobGroups(groups): JobGroup[] {
    if (!groups) {
        return [];
    }

    return __map(groups, (dto: any) => ({
        Name: dto.n,
        Status: ActivityStatus.findBy(parseInt(dto.s, 10)),
        Jobs: mapJobs(dto.jb)
    }));
}
開發者ID:guryanovev,項目名稱:CrystalQuartz,代碼行數:11,代碼來源:common-mappers.ts

示例9: mapJobs

function mapJobs(jobs): Job[] {
    if (!jobs) {
        return [];
    }

    return __map(jobs, (dto: any) => ({
        Name: dto.n,
        Status: ActivityStatus.findBy(parseInt(dto.s, 10)),
        GroupName: dto.gn,
        UniqueName: dto['_'],
        Triggers: mapTriggers(dto.tr)
    }));
}
開發者ID:guryanovev,項目名稱:CrystalQuartz,代碼行數:13,代碼來源:common-mappers.ts

示例10: mapInProgress

function mapInProgress(inProgress): RunningJob[] {
    if (!inProgress) {
        return [];
    }

    return __map(inProgress, (dto: any) => {
        const parts = parseJoined(dto, 2);

        return {
            FireInstanceId: parts[0],
            UniqueTriggerKey: parts[1]
        };
    });
}
開發者ID:guryanovev,項目名稱:CrystalQuartz,代碼行數:14,代碼來源:common-mappers.ts


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