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


TypeScript lodash.findLast函数代码示例

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


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

示例1: findContainer

 .forEach((s: SymbolInformation, index: number, arr: SymbolInformation[]) => {
   let container: Container;
   /**
    * For Enum class in Java, the container name and symbol name that LSP gives are special.
    * For more information, see https://github.com/elastic/codesearch/issues/580
    */
   if (s.containerName === SPECIAL_CONTAINER_NAME) {
     container = _.findLast(
       arr.slice(0, index),
       (sy: SymbolInformation) => sy.name === SPECIAL_SYMBOL_NAME
     );
   } else {
     container = findContainer(structureTree, s.containerName);
   }
   if (container) {
     if (!container.path) {
       container.path = container.name;
     }
     if (container.members) {
       container.members.push({ ...s, path: `${container.path}/${s.name}` });
     } else {
       container.members = [{ ...s, path: `${container.path}/${s.name}` }];
     }
   } else {
     structureTree.push({ ...s, path: s.name });
   }
 });
开发者ID:elastic,项目名称:kibana,代码行数:27,代码来源:symbol.ts

示例2: function

      $scope.syncFromOrcid = function() {
        $scope.busy = 'sync';

        const account = _.findLast($scope.user.externalIds, {type: 'orcid'});

        $http.put(config.apiUrl +
                  '/people/' + $scope.user.id + '/syncFromOrcid').
          success(function(data) {
            $scope.busy = false;
            authService.user = data;
          }).
          error(function(data) {
            $scope.busy = false;
            notificationService.httpError('could not sync data');
          });
      };
开发者ID:carolinagc,项目名称:paperhive-frontend,代码行数:16,代码来源:settings.ts

示例3: function

    this.$rootScope.$on('timeframeZoom', function (event, zoom) {
      let diff = zoom.to - zoom.from;

      let timeframe = _.findLast(that.timeframes, function (timeframe: Timeframe) {
        return timeframe.range < diff;
      });

      if (!timeframe) {
        timeframe = that.timeframes[0];
      }

      that.update({
        interval: timeframe.interval,
        from: zoom.from,
        to: zoom.to
      });
    });
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:17,代码来源:dashboard-timeframe.controller.ts

示例4: update

  update(timeframeParam) {
    let that = this;

    let timeframe = {
      interval: parseInt(timeframeParam.interval),
      from: parseInt(timeframeParam.from),
      to: parseInt(timeframeParam.to)
    };

    // Select the best timeframe
    let diff = timeframe.to - timeframe.from;

    let tf = _.findLast(that.timeframes, function (tframe: Timeframe) {
      return tframe.range <= diff;
    });

    this.timeframe = tf ? tf : that.timeframes[0];

    // timeframeChange event is dynamically initialized, so we have to define a timeout to correctly fired it
    this.$timeout(function () {
      let event = {
        interval: that.timeframe.interval,
        from: timeframe.from,
        to: timeframe.to
      };

      that.onTimeframeChange({timeframe: event});
    }, 200);

    this.current = {
      interval: this.timeframe.interval,
      intervalLabel: moment.duration(this.timeframe.interval).humanize(),
      from: timeframe.from,
      to: timeframe.to
    };

    this.$state.transitionTo(
      this.$state.current, _.merge(this.$state.params, this.current));

    this.pickerStartDate = moment(timeframe.from);
    this.pickerEndDate = moment(timeframe.to);
  }
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:42,代码来源:dashboard-timeframe.controller.ts

示例5: updateRangeDate

  updateRangeDate() {
    let from =  this.pickerStartDate.startOf('minute').unix() * 1000;
    let to = this.pickerEndDate.endOf('minute').unix() * 1000;

    let diff = to - from;

    let timeframe = _.findLast(this.timeframes, function (timeframe: Timeframe) {
      return timeframe.range < diff;
    });

    if (!timeframe) {
      timeframe = this.timeframes[0];
    }

    this.update({
      interval: timeframe.interval,
      from: from,
      to: to
    });
  }
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:20,代码来源:dashboard-timeframe.controller.ts


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