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

TypeScript lodash.min函数代码示例

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

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



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

示例1: function

        scope.$watch('highlightTarget', function(target) {
          if (!target) {
            scope.rects = undefined;
            scope.highlightInfo = undefined;
            return;
          }

          if (target.ranges.length) {
            scope.rects = containerCtrl.getRangesRects(target.ranges);

            // gather bbox information and expose it on the scope
            const info = {
              left: _.min(_.map(scope.rects, 'left')),
              right: _.max(_.map(scope.rects, function(rect) {
                return rect.left + rect.width;
              })),
              top: _.min(_.map(scope.rects, 'top')),
              bottom: _.max(_.map(scope.rects, function(rect) {
                return rect.top + rect.height;
              })),
              width: undefined,
              height: undefined,
            };
            info.width = info.right - info.left;
            info.height = info.bottom - info.top;
            scope.highlightInfo = info;
          }
        }, true);
开发者ID:carolinagc,项目名称:paperhive-frontend,代码行数:28,代码来源:highlights.ts


示例2: getRate

function getRate(yLeft, yRight) {
  var rateLeft, rateRight, rate;
  if (checkTwoCross(yLeft, yRight)) {
    rateLeft = yRight.min ? yLeft.min / yRight.min : 0;
    rateRight = yRight.max ? yLeft.max / yRight.max : 0;
  } else {
    if (checkOneSide(yLeft, yRight)) {
      var absLeftMin = Math.abs(yLeft.min);
      var absLeftMax = Math.abs(yLeft.max);
      var absRightMin = Math.abs(yRight.min);
      var absRightMax = Math.abs(yRight.max);
      var upLeft = _.max([absLeftMin, absLeftMax]);
      var downLeft = _.min([absLeftMin, absLeftMax]);
      var upRight = _.max([absRightMin, absRightMax]);
      var downRight = _.min([absRightMin, absRightMax]);

      rateLeft = downLeft ? upLeft / downLeft : upLeft;
      rateRight = downRight ? upRight / downRight : upRight;
    } else {
      if (yLeft.min > 0 || yRight.min > 0) {
        rateLeft = yLeft.max / yRight.max;
        rateRight = 0;
      } else {
        rateLeft = 0;
        rateRight = yLeft.min / yRight.min;
      }
    }
  }

  rate = rateLeft > rateRight ? rateLeft : rateRight;

  return rate;
}
开发者ID:cboggs,项目名称:grafana,代码行数:33,代码来源:align_yaxes.ts


示例3: tilesInView

 get tilesInView(): TilesInView {
     var startCol: number = _.floor(this.camera.x / this.map.tileWidth);
     var endCol: number = startCol + (this.camera.width / this.map.tileWidth);
     var startRow: number = _.floor(this.camera.y / this.map.tileHeight);
     var endRow: number = startRow + (this.camera.height / this.map.tileHeight);
     return {
         startCol: startCol, 
         endCol: _.min([endCol, this.map.colCount - 1]), 
         startRow: startRow, 
         endRow: _.min([endRow, this.map.rowCount - 1])
     };
 }
开发者ID:rbcasperson,项目名称:canvas-tile-map,代码行数:12,代码来源:game.ts


示例4:

 function removeMin<T>(array: T[]) {
   if (array.length > 0) {
     const minIdx = array.indexOf(min(array)!);
     array[minIdx] = array[array.length - 1];
     array.length--;
   }
 }
开发者ID:gristlabs,项目名称:grainjs,代码行数:7,代码来源:PriorityQueue.ts


示例5: enabler

 "!typegame": enabler((command: Tennu.Command) => {
     var cache = typegameCache[command.channel] = typegameCache[command.channel] || { running: false };
     if (typegameCache[command.channel].running) {
         return util.format("A game is still running! Name %s PokĂŠmon with the type %s!", cache.cnt, cache.types.join("/"));
     } else {
         (runningCache[command.channel] = runningCache[command.channel] || []).push("typegame")
         var {type, cnt} = _.sample(Data.type_count_array);
         console.log(cnt);
         cache = typegameCache[command.channel] = {
             running: true,
             type: type,
             cnt: _.random(1, _.min([5, cnt])),
             max: cnt,
             userCount: {},
             guessed: {},
             types: []
         };
         for (var i = 0; type; type >>= 1, ++i) {
             if (type&1)
                 cache.types.push(Data.type_list[i]);
         }
         return util.format("Name %s PokĂŠmon with the type %s!",
                             cache.cnt, cache.types.join("/")
         );
     }
 }),
开发者ID:Cu3PO42,项目名称:CuBoid,代码行数:26,代码来源:typegame.ts


示例6: createScales

export function createScales(props: PositionsBubbleChartProps) {
  const ratio = 12.5
  const { width, height } = props.size
  const minR = 15
  const maxR = 60
  const offset = maxR / 2
  const positionData = getPositionsDataFromSeries(props.data, props.currencyPairs)

  const baseValues = _.map(positionData, (val: any) => {
    return Math.abs(val[baseTradedAmountName])
  })

  const maxValue = _.max(baseValues) || 0
  let minValue = _.min(baseValues) || 0

  if (minValue === maxValue) minValue = 0

  const scales = {
    x: d3.scale.linear()
      .domain([0, props.data.length])
      .range([(-(width / ratio)), (width / ratio) - offset]),
    y: d3.scale.linear()
      .domain([0, props.data.length])
      .range([-(height / (ratio)), height / ratio]),
    r: d3.scale.sqrt()
      .domain([minValue, maxValue])
      .range([minR, maxR])}

  return scales
}
开发者ID:carlosrfernandez,项目名称:ReactiveTraderCloud,代码行数:30,代码来源:chartUtil.ts


示例7: reposition

          function reposition() {
            // set height of element such that it fits the viewport
            // note: the 1px prevents scroll bars in certain situations
            const height = min([
              jquery($window).innerHeight() - params.offsetTop -
                params.offsetBottom - 1,
              element[0].scrollHeight,
            ]);
            element.css({height: height > 0 ? height + 'px' : 'auto'});

            // get position of parent
            const offsetParent = element[0].offsetParent;
            if (!offsetParent) { return; }
            const parentRect = offsetParent.getBoundingClientRect();

            // positioned normally
            let affixed = false;

            if (parentRect.top >= params.offsetTop) {
              // not affixed (aka affixed to top of container)
              element.css({position: 'static', top: 0});
            } else {
              affixed = true;
              if (parentRect.top + parentRect.height < height + params.offsetTop) {
                // affixed to bottom of container
                element.css({position: 'relative', top: parentRect.height - height});
              } else {
                // affixed to top of viewport (plus offsetTop)
                element.css({
                  position: 'relative',
                  top: -parentRect.top + params.offsetTop,
                });
              }
            }
          }
开发者ID:paperhive,项目名称:paperhive-frontend,代码行数:35,代码来源:affix.ts


示例8: addXHistogramAxis

      function addXHistogramAxis(options, bucketSize) {
        let ticks, min, max;

        if (data.length) {
          ticks = _.map(data[0].data, point => point[0]);

          // Expand ticks for pretty view
          min = Math.max(0, _.min(ticks) - bucketSize);
          max = _.max(ticks) + bucketSize;

          ticks = [];
          for (let i = min; i <= max; i += bucketSize) {
            ticks.push(i);
          }
        } else {
          // Set defaults if no data
          ticks = panelWidth / 100;
          min = 0;
          max = 1;
        }

        options.xaxis = {
          timezone: dashboard.getTimezone(),
          show: panel.xaxis.show,
          mode: null,
          min: min,
          max: max,
          label: "Histogram",
          ticks: ticks
        };
      }
开发者ID:navedalam,项目名称:grafana,代码行数:31,代码来源:graph.ts


示例9: getFirstAvailableSemester

export function getFirstAvailableSemester(
  semesters: ReadonlyArray<SemesterDataCondensed>,
  current: Semester = config.semester, // For testing only
): Semester {
  const availableSemesters = semesters.map((semesterData) => semesterData.semester);
  return availableSemesters.includes(current) ? current : _.min(availableSemesters)!;
}
开发者ID:nusmodifications,项目名称:nusmods,代码行数:7,代码来源:modules.ts


示例10: getDomainBoundaries

 /*
  * max & min value from two-dimensional array
  */
 public getDomainBoundaries(tsv: TSVFile): DomainBoundaries {
   const chipIndexes = this.getChipHeaderIndexes(tsv.headers);
   const values = _.map(tsv.body.rows, (row: TSVRow) => row.getCellsByIndexes(chipIndexes));
   const flatValues = _.map(_.flatten(values), (value: string) => parseFloat(value));
   const min = _.min(flatValues);
   const max = _.max(flatValues);
   return new DomainBoundaries(min, max);
 }
开发者ID:chipster,项目名称:chipster-web,代码行数:11,代码来源:visualizationTSV.service.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript lodash.minBy函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lodash.mergeWith函数代码示例发布时间: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