/
number.ts
51 lines (50 loc) · 1.19 KB
/
number.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/**
* Multiplies a value by 2. (Also a full example of TypeDoc's functionality.)
*
* ### Example (es module)
* ```js
* import { double } from 'typescript-starter'
* console.log(double(4))
* // => 8
* ```
*
* ### Example (commonjs)
* ```js
* var double = require('typescript-starter').double;
* console.log(double(4))
* // => 8
* ```
*
* @param value - Comment describing the `value` parameter.
* @returns Comment describing the return type.
* @anotherNote Some other value.
*/
export const double = (value: number) => {
return value * 2;
};
/**
* Raise the value of the first parameter to the power of the second using the
* es7 exponentiation operator (`**`).
*
* ### Example (es module)
* ```js
* import { power } from 'typescript-starter'
* console.log(power(2,3))
* // => 8
* ```
*
* ### Example (commonjs)
* ```js
* var power = require('typescript-starter').power;
* console.log(power(2,3))
* // => 8
* ```
* @param base - the base to exponentiate
* @param exponent - the power to which to raise the base
*/
export const power = (base: number, exponent: number) => {
/**
* This es7 exponentiation operator is transpiled by TypeScript
*/
return base ** exponent;
};