本文整理汇总了TypeScript中lodash.floor函数的典型用法代码示例。如果您正苦于以下问题:TypeScript floor函数的具体用法?TypeScript floor怎么用?TypeScript floor使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了floor函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: tilesInView
get tilesInView(): TilesInView {
var startCol: number = _.floor(this.camera.x / this.map.tileWidth);
var endCol: number = startCol + (this.camera.width / this.map.tileWidth);
var startRow: number = _.floor(this.camera.y / this.map.tileHeight);
var endRow: number = startRow + (this.camera.height / this.map.tileHeight);
return {
startCol: startCol,
endCol: _.min([endCol, this.map.colCount - 1]),
startRow: startRow,
endRow: _.min([endRow, this.map.rowCount - 1])
};
}
示例2: main
async function main() {
const config = getConfigRoot();
const bfConfig = findBrokerConfig(config, 'Bitflyer');
const bfApi = new BitflyerApi(bfConfig.key, bfConfig.secret);
const bfBalance = await bfApi.getBalance();
const bfBtc = (bfBalance.find(x => x.currency_code === 'BTC') as Balance).available;
const request = {
product_code: 'BTC_JPY',
child_order_type: 'MARKET',
side: 'SELL',
size: _.floor(bfBtc, 4)
};
try {
console.log(`Selling ${bfBtc}...`);
const response = await bfApi.sendChildOrder(request);
console.log(response);
} catch (ex) {
console.log(ex.message);
}
}
示例3: roundDown
function roundDown(valueToFloor: number): number {
return _.floor(valueToFloor)
}
示例4: getFloor
getFloor(first: number, second: number) {
return first <= second ? _.floor(first) : _.floor(second);
}