This file contains 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
/** | |
@func | |
generate an arr of random nums | |
- containing numbers only between the supplied min and max | |
@param {number} min - smallest num in arr | |
@param {number} max - largest num in arr | |
@param {number} len - length of the arr to create | |
@return {number[]} | |
*/ |
This file contains 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
/* | |
@file | |
@legend | |
n = node | |
@tasks | |
minnode method is missing | |
*/ |
This file contains 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
/** | |
@func | |
log how long it takes to run a block of code | |
- for a supplied number of times | |
@warning | |
the supplied func runs in a loop | |
- so first make sure there are no log statements in the func | |
- either comment them out, or replace them with lMock... | |
- const l = s => undefined; //lMock |
This file contains 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
/** | |
@func complement | |
confirm that the supplied value is not an obj | |
@param {*} v expect anything but an obj | |
@return {boolean} | |
*/ | |
export const isNotObj = v => !isObj(v); |
This file contains 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
/** | |
@func | |
Map object factory | |
@return {Map} | |
*/ | |
export const createLruMap = () => new Map(); | |
/** |
This file contains 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
// place this into your Visual Studio Code (VSC) settings json file (I have it in my Workspace settings, not User settings) | |
// res: explanation and contact here... https://dev.to/functional_js/visual-studio-code-my-color-syntax-settings-2kl6 | |
//colors //////////////////////////////////////////////////////// | |
"workbench.colorTheme": "Default High Contrast", | |
// "workbench.colorTheme":"Default Dark+", | |
//already black, but as an example | |
"workbench.colorCustomizations": { | |
"sideBar.background": "#000", | |
"editorLineNumber.foreground": "#203752", | |
"terminal.background": "#07000c", |
This file contains 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
/** | |
@func | |
true if var is null or undefined | |
@param {*} v | |
@return {boolean} | |
*/ | |
export const isNil = v => v === undefined || v === null; | |
//@tests |
This file contains 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
/** | |
@func | |
with a supplied func and a supplied arr of args | |
- the func will invoke once for each arg in the arr | |
apply the func to each arg in the arr | |
@cons | |
this variant only supports funcs that are unary (argument count of one) | |
@param {(v: *) => *} fn - the func to be invoked for each elem in the arr |
This file contains 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
/** | |
@func | |
calculate if credit card number is valid | |
@param {number|string} ccn Credit Card Number | |
@return {boolean} | |
*/ | |
const isCcValidLuhn = ccn => { | |
const sum = ccn | |
.toString() |