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

TypeScript ramda.range函数代码示例

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

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



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

示例1: range

        .then(({ data: firstPageData, page, pages, results }) => {

          // If we only have one page, return it.
          if (page === pages) {
            return {
              data: firstPageData,
              results
            };
           }

          // Create an iterable list of the remaining pages.
          const remainingPages = range(page + 1, pages + 1);

          //
          return Bluebird
            .map(remainingPages, nextPage =>
              getter({ ...pagination, page: nextPage }, filter).then(response => response.data),
            )
            /** We're given Linode.NodeBalancer[][], so we flatten that, and append the first page response. */
            .then(resultPages => {
              const combinedData = resultPages.reduce((result, nextPage) => {
              return [...result, ...nextPage]
            }, firstPageData);
              return {
                data: combinedData,
                results
              }
          });
        });
开发者ID:displague,项目名称:manager,代码行数:29,代码来源:getAll.ts


示例2: pins

function pins(
  { frame, squareNumber }: FramePinState,
  dispatch: (action: FrameAction) => void,
) {
  const frameOptions = {
    key: frame.id,
    onclick() {
      dispatch({ type: "cycle" })
    },
    style: "cursor: pointer;",
    className: frame.id === 10 ? "tenth-frame" : "",
  }

  const standingPins = frame.squares[squareNumber - 1].standingPins
  return m("li", frameOptions, [
    m(".frame-number-container", frame.id),
    m(".score-container", [
      m(".shot-number", squareNumber),
      m(
        ".pins",
        range(0, 10).map(n => {
          const isStanding = standingPins & (1 << n) ? ".isStanding" : ""
          return m(`.pin.pin-${n + 1}${isStanding}`)
        }),
      ),
    ]),
  ])
}
开发者ID:nordfjord,项目名称:eyc-live,代码行数:28,代码来源:Frame.ts


示例3: range

const MainComponent = () => {
  const lanes = range(1, 11)
  return {
    view() {
      return m(".bowling-container.container-fluid", [
        m("a[href=/stats].stats-link", [
          m("i.fa.fa-bar-chart-o"),
          "\u00a0",
          "See Statistics from EYC",
        ]),
        m("h1.page-title", "EYC 2016 Live Scoring"),
        m("h2.sub-title", "Scores are refreshed every 30 seconds"),
        m(
          ".row",
          lanes.map(function(laneNumber) {
            const l1 = laneNumber * 2 + 1
            const l2 = laneNumber * 2 + 2
            return [
              m(
                ".col-xs-12.col-sm-12.col-md-6.col-lg-6",
                m(Lane, { laneNumber: l1 }),
              ),
              m(
                ".col-xs-12.col-sm-12.col-md-6.col-lg-6",
                m(Lane, { laneNumber: l2 }),
              ),
            ]
          }),
        ),
        m(".footer", [
          m("p", [
            m("i.fa.fa-heart"),
            " from ",
            m("a[href=https://twitter.com/enordfjord]", "Einar"),
            m(
              "a[href=#].center",
              {
                onclick: scrollToTop,
              },
              [
                m("i.fa.fa-arrow-circle-o-up", {
                  style: "font-size: 24px",
                  title: "Scroll to top",
                }),
              ],
            ),
            m("span.pull-right", [
              "Powered by ",
              m("a[href=https://xbowling.com]", "MSCN XBowling"),
              " API",
            ]),
          ]),
        ]),
      ])
    },
  }
}
开发者ID:nordfjord,项目名称:eyc-live,代码行数:57,代码来源:app.ts


示例4: upToConditional

    static upToConditional(n) {
        const isModuloOf = mod => i => i % mod === 0;
        const fb = R.cond([
            [isModuloOf(15), R.always('fizzbuzz')],
            [isModuloOf(5), R.always('buzz')],
            [isModuloOf(3), R.always('fizz')],
            [R.T, i => '' + i]
        ]);

        return R.map(fb, R.range(1, R.inc(n)));
	}
开发者ID:sprengerjo,项目名称:katas_js,代码行数:11,代码来源:fizzbuzz.ts


示例5: upToPipeline

    static upToPipeline(n) {
		const isModuloOf = mod => (i: any): boolean => i % mod === 0;
		const apply = (m, s) => R.when(isModuloOf(m), R.always(s))

		const fizzBuzz = apply(15, 'fizzbuzz')
		const fizz = apply(3, 'fizz')
		const buzz = apply(5, 'buzz')

		const fizzbuzzPipeline = R.pipe(fizzBuzz, fizz, buzz, (i) => '' + i)

        return R.map(fizzbuzzPipeline, R.range(1, R.inc(n)));
    }
开发者ID:sprengerjo,项目名称:katas_js,代码行数:12,代码来源:fizzbuzz.ts


示例6: upToLookUp

    static upToLookUp(n) {
        const s = R.toString
        const f = R.always('fizz');
        const b = R.always('buzz');
        const fb = R.always(f() + b());
        const funs = [s, s, f, s, b, f, s, s, f, b, s, f, s, s, fb];

        const selectFun: any = (n) => R.nth(R.modulo(R.dec(n), 15), funs);
        const fizzBuzzify = (n) => R.call(selectFun(n), n);

        return R.map(fizzBuzzify, R.range(1, R.inc(n)));
    }
开发者ID:sprengerjo,项目名称:katas_js,代码行数:12,代码来源:fizzbuzz.ts


示例7: constructor

  constructor (width: number, height: number) {
    if (width % 2 == 0 || height % 2 == 0) {
      throw new Error('FaceGrid expects uneven width and height!')
    }

    this.width = width
    this.height = height

    this.centerX = Math.floor(width / 2)
    this.centerY = Math.floor(height / 2)

    // Generate the drawing structure
    this.coordsMap = range(0, this.height).map(row => range(0, this.width).map(col => 0))

    // Mark center for debug reasons
    //this.markDrawPoint(this.centerX, this.centerY)

    this.generateFaceDimensions()
    this.generateSkeleton()
  }
开发者ID:neonerd,项目名称:weallmeetatthoseplaces,代码行数:20,代码来源:FaceGenerator.ts


示例8:

 // Join: [1,2,3], [4,5,6], [7,8,9] -> [1,4,7], [2,5,8], [3,6,9]
 (results) => R.map((i) => R.map((item) => item[i], results), R.range(0, results[0].length)),
开发者ID:d4rkr00t,项目名称:vscode-open-in-github,代码行数:2,代码来源:common.ts


示例9: range

this.coordsMap = range(0, this.height).map(row => range(0, this.width).map(col => 0))
开发者ID:neonerd,项目名称:weallmeetatthoseplaces,代码行数:1,代码来源:FaceGenerator.ts


示例10: solve

function solve(maxValue: number): number {
    return R.sum(R.map((n: number) => (n % 5 == 0 || n % 3 == 0) ? n : 0,
        R.range(1, maxValue)));
}
开发者ID:kellyi,项目名称:katas,代码行数:4,代码来源:ts_euler1.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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