ncube-thyme-typescript
Version:
nCube Thyme for Typescript (oneM2M client)
52 lines (50 loc) • 1.22 kB
text/typescript
/**
* 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;
};