This package should not be taken very seriously BUT it does provide many useful features.
npm install frotsiFlatten sometimes can't in more complicated and nested object types.
npm you should import the library at the top of your project's main (root) JS/TS file, so the global object extensions can attach themselves.
sh
import 'frotsi';
import ...
...
`
Usage
After installing and importing, use it anywhere in your app, like so:
`sh
MATH:
Math.randomInt(1, 2); // --> '1' OR '2'
ARRAY:
[13,67,4,24,566].sortNumbers(); // --> '[4, 13, 24, 67, 566]'
[1, 2, 3].random(); // --> get one item from provided array
[1, 2, 3].random(2); // --> get two item from provided array
[1, 2, 3].popRandom(); // --> pop one item from provided array
[1, 2, 3].symmetricDifference([1, 2, 3, 3, 4]); // --> '{ diffBase: [], diffCompared: [4] }'
PROMISE:
new Promise( ... ).fireAndForget(); // --> 'undefined' - simply fires a Promise
new Promise( ... ).fireAndForget(true); // --> 'undefined' - simply fires a Promise + logs errors
OTHER:
generateInputId('select', 'project-role'); // --> '@id_4796_5196_input_select_data_project-role'
generateDocumentId(); // --> '20230525_022358_902Z_420'
loop(5).forEach(index => { ... }); // --> 'undefined' - loops 5 times
loop(5).map(index => ({index: ${index}})); // --> '{index: string}[]' - loop 5 times and returns 5-element typed array
LocalStorage.setItem(user, {user: 'John'})
``