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:
661 bytes
|
Line | |
---|
1 | import { bind, curryN } from 'ramda';
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Returns the value of a number rounded to the nearest integer.
|
---|
5 | *
|
---|
6 | * @func round
|
---|
7 | * @memberOf RA
|
---|
8 | * @since {@link https://char0n.github.io/ramda-adjunct/2.15.0|v2.15.0}
|
---|
9 | * @category Math
|
---|
10 | * @sig Number -> Number
|
---|
11 | * @param {number} number The number to round
|
---|
12 | * @return {number} The value of the given number rounded to the nearest integer
|
---|
13 | * @example
|
---|
14 | *
|
---|
15 | * RA.round(0.9); //=> 1
|
---|
16 | * RA.round(5.95); //=> 6
|
---|
17 | * RA.round(5.5); //=> 6
|
---|
18 | * RA.round(5.05); //=> 5
|
---|
19 | * RA.round(-5.05); //=> -5
|
---|
20 | * RA.round(-5.5); //=> -5
|
---|
21 | * RA.round(-5.95); //=> -6
|
---|
22 | */
|
---|
23 |
|
---|
24 | const round = curryN(1, bind(Math.round, Math));
|
---|
25 |
|
---|
26 | export default round;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.