当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript lodash.slice函数代码示例

本文整理汇总了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;未经允许,请勿转载。