Created
May 17, 2020 21:01
-
-
Save clintonyeb/ddc21d8ac52d632bc26cc34bb4128646 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {string} array Array | |
* @param {string} n Number of values that needs to be returned from Array | |
* @returns return new Array with the size n | |
*/ | |
export function lastNMembers(array, n) { | |
if (array == null) { | |
return void 0; | |
} | |
if (n == null) { | |
return array[array.length - 1]; | |
} | |
return array.slice(Math.max(array.length - n, 0)); | |
} | |
/** | |
* @param {string} value The target for wrapper | |
* @returns Create html wrapper for moving average for displaying big number | |
*/ | |
export function containerClassBig(value: string): string { | |
return `<span class="big">${value}</span>`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment