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

TypeScript lodash.slice函数代码示例

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

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



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

示例1:

    _.each(this.data.columns, (data) => {

      // x축 데이터 categoryName에 설정
      const nameList: string[] = _.split(data.name, CHART_STRING_DELIMITER);

      let categoryList = [];
      let seriesList = [];

      // 열에만 dimension1개가 존재하는경우
      if (0 == nameList.indexOf(this.pivot.aggregations[0].alias)) {
        seriesList = nameList.splice(1, this.pivot.rows.length);
      } else {
        // columns 개수만큼 리스트 잘라서 설정
        categoryList = nameList.splice(0, this.pivot.columns.length);
        // rows 개수만큼 리스트 잘라서 설정
        seriesList = nameList.splice(0, this.pivot.rows.length);
      }

      data.categoryName = _.cloneDeep(_.join(_.slice(categoryList, 0, this.pivot.columns.length), CHART_STRING_DELIMITER));

      data.seriesName = _.cloneDeep(_.join(_.slice(seriesList, 0, this.pivot.rows.length), CHART_STRING_DELIMITER));

      // 해당 dataIndex로 설정
      data.seriesValue = _.cloneDeep(data.value[2]);
    });
开发者ID:bchin22,项目名称:metatron-discovery,代码行数:25,代码来源:heatmap-chart.component.ts


示例2: function

  const serialize = function() {
    // only need to return the unspents that were used and just the chainPath, redeemScript, and instant flag
    const pickedUnspents: any = _.map(unspents, function(unspent) {
      return _.pick(unspent, ['chainPath', 'redeemScript', 'instant', 'witnessScript', 'script', 'value']);
    });
    const prunedUnspents = _.slice(pickedUnspents, 0, transaction.tx.ins.length - feeSingleKeyUnspentsUsed.length);
    _.each(feeSingleKeyUnspentsUsed, function(feeUnspent) {
      prunedUnspents.push({ redeemScript: false, chainPath: false }); // mark as false to signify a non-multisig address
    });
    const result: any = {
      transactionHex: transaction.buildIncomplete().toHex(),
      unspents: prunedUnspents,
      fee: fee,
      changeAddresses: changeOutputs.map(function(co) {
        return _.pick(co, ['address', 'path', 'amount']);
      }),
      walletId: params.wallet.id(),
      walletKeychains: params.wallet.keychains,
      feeRate: feeRate,
      instant: params.instant,
      bitgoFee: bitgoFeeInfo,
      estimatedSize: minerFeeInfo.size,
      txInfo: txInfo,
      travelInfos: travelInfos
    };

    // Add for backwards compatibility
    if (result.instant && bitgoFeeInfo) {
      result.instantFee = _.pick(bitgoFeeInfo, ['amount', 'address']);
    }

    return result;
  };
开发者ID:BitGo,项目名称:BitGoJS,代码行数:33,代码来源:transactionBuilder.ts


示例3: postVideosSearch

  private postVideosSearch(req: express.Request, res: express.Response): void {
    let searchTerm = req.body.searchTerm;

    console.log(`searching for ${searchTerm} locally`);

    if (searchTerm.startsWith("/yt")) {
      this.postVideosYouTubeSearch(req, res);
    } else if (searchTerm.startsWith("/group") || searchTerm.startsWith("/g")) {
      searchTerm = _.slice(searchTerm.split(" "), 1).join(" ");

      if (searchTerm === "all") {
        this.db.getAllVideosFromDB(data => {
          res.json(data);
        });
      } else {
        this.db.getAllVideosForGroupFromDB(searchTerm, data => {
          res.json(data);
        });
      }
    } else {
      this.db.getVideosWhereTitleLikeFromDB(searchTerm, data => {
        res.json(data);
      });
    }
  }
开发者ID:frankhale,项目名称:toby,代码行数:25,代码来源:api.ts


示例4: createSelector

export const selectFindData = createSelector(selectSearchData, getSearchText, getSearchMode, (searchData, text, mode) => {
  const maxItems = 7;
  if (searchData && text && mode) {
    let regex = new RegExp(text, 'i');
    let matchArr = [];
    searchData.map(item => {
      if (item.value.match(regex)) { matchArr.push(item) }
    })
    if (matchArr.length > maxItems) { return slice(matchArr, 0, maxItems) }
    else { return matchArr }
// Ввод не трогали
  } else if (searchData && mode && !text) {
    if (searchData.length > maxItems) { return slice(searchData, 0, maxItems) }
    else { return searchData }
  }
  else { return []}
})
开发者ID:phdog,项目名称:typeahead,代码行数:17,代码来源:search.ts


示例5:

      this.walletProvider.getBalance(this.wallet, {}).then((resp: any) => {
        this.withBalance = resp.byAddress;

        var idx = _.keyBy(this.withBalance, 'address');
        this.noBalance = _.reject(allAddresses, (x: any) => {
          return idx[x.address];
        });

        this.processList(this.noBalance);
        this.processList(this.withBalance);

        this.latestUnused = _.slice(this.noBalance, 0, this.UNUSED_ADDRESS_LIMIT);
        this.latestWithBalance = _.slice(this.withBalance, 0, this.BALANCE_ADDRESS_LIMIT);
        this.viewAll = this.noBalance.length > this.UNUSED_ADDRESS_LIMIT || this.withBalance.length > this.BALANCE_ADDRESS_LIMIT;

        this.loading = false;
      }).catch((err: any) => {
开发者ID:bitjson,项目名称:copay,代码行数:17,代码来源:wallet-addresses.ts


示例6: transformRows

    transformRows(rows: Array<IRow>):Array<IRow> {
        if(this.isActive() == false){
            return rows;
        }

        this.totalRowsCount = rows.length; // question if this is the right approach

        return _.slice(rows, this.getStartIndex(), this.getStartIndex() + this.itemsPerPage);
    }
开发者ID:iamisti,项目名称:mdDataTable2,代码行数:9,代码来源:ArrayPaginationService.ts


示例7:

const isStraightComplete = (board : string[][]) => {
  for (let x = 0; x < 6; x++) {
    for (let y = 0; y < 2; y++) {
      let slice = _.slice(board[x], y, 5 + y);
      if (isSliceComplete(slice)) return true;
    }
  }
  return false;
}
开发者ID:carlintj,项目名称:orderchaos,代码行数:9,代码来源:isOver.ts


示例8: _getBlueprints

function _getBlueprints(positional:meow.ParsedValue[]):string[] {
  const result = _.partition(_.slice(positional, 0, -1), _isValidPackage);
  if (result[1].length) {
    const prettyNames = result[1].map(n => `'${n}'`).join(', ');
    throw new StacklessError(`The following blueprints are not valid npm package name(s): ${prettyNames}`);
  }

  return result[0].map(String);
}
开发者ID:convoyinc,项目名称:opine,代码行数:9,代码来源:cli.ts


示例9: slice

 const golfers: UpdateGolfer[] = golferTrs.map(tr => {
   const tds = tr.querySelectorAll('td');
   const name = tds[0].textContent.trim();
   const dayScores = slice(tds, 2, 6).map(td => parseDayScore(td, par));
   return {
     scores: dayScores,
     golfer: name,
     day: dayScores.length,
     thru: constants.NHOLES
   };
 });
开发者ID:odetown,项目名称:golfdraft,代码行数:11,代码来源:pgaTourHistoricHtmlReader.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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