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

TypeScript lodash.zip函数代码示例

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

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



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

示例1: mt2tpb

/**
 * Get T,P and B axes from moment tensor 
 * 
 * @param mt - moment tensor matrix
 */
function mt2tpb(mt: number[][]) {
    var {
        eigenvalues,
        eigenvectors
    } = eigen(mt)

    var t = [eigenvalues[0], eigenvalues[1], eigenvalues[2]]
    var azelever = cart2sph(eigenvectors[1], numeric.mul(eigenvectors[2], -1), eigenvectors[0])
    var b = azelever.az
    var p = azelever.elev

    // get into degrees
    b = b.map(item => item * bbmath.R2D)

    p = p.map(item => item * bbmath.R2D)

    b = _.zip(p, b).map(pb => pb[0] < 0 ? pb[1] + 180 : pb[1])

    p = p.map(item => Math.abs(item))

    //force azimuth to be in 0-360
    b = b.map(item => item >= 360 ? item - 360 : item)
    b = b.map(item => item < 0 ? item + 360 : item)

    return {
        t: [t[2], p[2], b[2]],
        p: [t[0], p[0], b[0]],
        b: [t[1], p[1], b[1]]
    }
}
开发者ID:timofeevda,项目名称:seismic-beachballs,代码行数:35,代码来源:bbutils.ts


示例2: iterchunks

export function iterchunks (orbs: Orb[][], chunkLimitRange: [number, number] = [4, 2], includePositionInformation = false): types.Chunk[] {
    let transposedOrbs: Orb[][] = _.zip(...orbs);
    return [
            ..._iterchunks(orbs, chunkLimitRange, includePositionInformation, false),
            ..._iterchunks(transposedOrbs, chunkLimitRange, includePositionInformation, true)
    ]
};
开发者ID:rbcasperson,项目名称:match-three-js,代码行数:7,代码来源:tools.ts


示例3: htmlPrintPpCmdsDiff

export function htmlPrintPpCmdsDiff(l : PpCmds, old : PpCmds) : string {
  _(patterns).each(pattern => {
    l = pattern(l)
    old = pattern(old)
  })
  if (!ppCmdsSameShape(l, old)) {
    return markDifferent(
      _.reduce(
        l,
        (acc : string, p : PpCmdType) => {
          return acc + htmlPrintPpCmd(p)
        },
        ''
      )
    )
  }
  const z = _.zip(l, old)
  return _.reduce(
    z,
    (acc : string, [p, oldP] : [PpCmdType, PpCmdType]) => {
      return acc + htmlPrintPpCmdDiff(p, oldP)
    },
    ''
  )
}
开发者ID:Ptival,项目名称:PeaCoq,代码行数:25,代码来源:printers.ts


示例4: buildRoute

function buildRoute(route: UncompiledRoute, currentPath: Array<string>): NgrxRoute {
  const { path, children } = route;
  const relativePath = path && map(dropWhile(zip(path.parts, currentPath), ([a, b]) => a === b), a => a[0]);

  return Object.assign({}, route, {
    path: path && (currentPath.length === 0 ? '/' : '') + relativePath.join('/'),
    children: children && children.map(child => buildRoute(child, relativePath || currentPath)),
  });
}
开发者ID:angryzor,项目名称:typesafe-urls-ngrx-router,代码行数:9,代码来源:index.ts


示例5: find

export function find(orbs: Orb[][]): number[][][] {
    let chunksOriginal = tools._iterchunks(orbs, [3, 1], true, false);
    let chunksTransposed = tools._iterchunks(_.zip(...orbs), [3, 1], true, true);

    return [
            ..._findTriples(chunksOriginal, false),
            ..._findTriples(chunksTransposed, true)
    ];
};
开发者ID:rbcasperson,项目名称:match-three-js,代码行数:9,代码来源:triples.ts


示例6: makePiece

export function makePiece(shape: string[], color: ColorIndex): Piece {
  // Map 1s to filled squares and 0s to to empty squares (null)
  const rows = shape.map((row) => row.split('').map((tile) => (tile === '1' ? { color } : null)));

  const tiles = zip(...rows) as Board;

  return {
    tiles,
    ...originalPosition(tiles),
  };
}
开发者ID:nusmodifications,项目名称:nusmods,代码行数:11,代码来源:board.ts


示例7: 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:CorpGlory,项目名称:grafana,代码行数:12,代码来源:colors.ts


示例8: describe

 describe(suiteName, () => {
   zip(testNames, tests).forEach(([name, value]) => {
     if (name.includes(":skip")) {
       return;
     }
     const testName = name.replace("// it:", "").trim();
     it(testName, async () => {
       const result = await evaluate(value);
       return assert.isTrue(typeof result === "boolean" && result);
     });
   });
 });
开发者ID:metaes,项目名称:metaes,代码行数:12,代码来源:runner.ts


示例9:

 const report = getters.reports.reduce((report1, report2) => {
   const chances1 = report1.roundedChances || [];
   const chances2 = report2.roundedChances || [];
   for (const [chance1 = 0, chance2 = 0] of zip(chances1, chances2)) {
     if (chance1 > chance2) return report1;
     if (chance2 > chance1) return report2;
   }
   if (!report2.damage) return report1;
   if (!report1.damage) return report2;
   if (report2.damage.max(NaN) > report1.damage.max(NaN)) return report2;
   return report1;
 }, emptyReport);
开发者ID:Sulcata,项目名称:Sulcata-Damage-Calculator,代码行数:12,代码来源:getters.ts


示例10: sortColorsByHue

export function sortColorsByHue(hexColors) {
  const hslColors = _.map(hexColors, hexToHsl);

  let sortedHSLColors = _.sortBy(hslColors, ['h']);
  sortedHSLColors = _.chunk(sortedHSLColors, PALETTE_ROWS);
  sortedHSLColors = _.map(sortedHSLColors, chunk => {
    return _.sortBy(chunk, 'l');
  });
  sortedHSLColors = _.flattenDeep(_.zip(...sortedHSLColors));

  return _.map(sortedHSLColors, hslToHex);
}
开发者ID:acedrew,项目名称:grafana,代码行数:12,代码来源:colors.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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