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


TypeScript ramda.range函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。