UNPKG

284 BJavaScriptView Raw
1'use strict';
2var ceil = Math.ceil;
3var floor = Math.floor;
4
5// `Math.trunc` method
6// https://tc39.es/ecma262/#sec-math.trunc
7// eslint-disable-next-line es/no-math-trunc -- safe
8module.exports = Math.trunc || function trunc(x) {
9 var n = +x;
10 return (n > 0 ? floor : ceil)(n);
11};