source: node_modules/ramda-adjunct/lib/trunc.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports.truncPonyfill = exports["default"] = void 0;
5var _ramda = require("ramda");
6var _Math = _interopRequireDefault(require("./internal/ponyfills/Math.trunc"));
7var _isFunction = _interopRequireDefault(require("./isFunction"));
8function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
9var truncPonyfill = (0, _ramda.curryN)(1, _Math["default"]);
10
11/**
12 * Returns the integer part of a number by removing any fractional digits.
13 *
14 * @func trunc
15 * @memberOf RA
16 * @since {@link https://char0n.github.io/ramda-adjunct/2.15.0|v2.15.0}
17 * @category Math
18 * @sig Number | String -> Number
19 * @param {number|string} number The number to trunc
20 * @return {number} The integer part of the given number
21 * @example
22 *
23 * RA.trunc(13.37); //=> 13
24 * RA.trunc(42.84); //=> 42
25 * RA.trunc(0.123); //=> 0
26 * RA.trunc(-0.123); //=> -0
27 * RA.trunc('-1.123'); //=> -1
28 * RA.trunc(NaN); //=> NaN
29 * RA.trunc('foo'); //=> NaN
30 */
31exports.truncPonyfill = truncPonyfill;
32var trunc = (0, _isFunction["default"])(Math.trunc) ? (0, _ramda.curryN)(1, (0, _ramda.bind)(Math.trunc, Math)) : truncPonyfill;
33var _default = trunc;
34exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.