Utility functions.
npm install @thermopylae/lib.utils
This package contains a collection of utility functions grouped into different categories, such as chrono, string, token, array etc.
Bellow is a simple example of how this module can be used:
import { array, number, chrono, string } from '@thermopylae/lib.utils';
const randomOffsets = array.filledWith(10, () => {
return number.randomInt(0, 10);
});
const timestamps = randomOffsets.map((offset) => {
return chrono.unixTime() + offset;
});
const randomUniqueStrings = array.filledWith(10, () => {
return string.random({ allowedCharRegex: /[a-z0-9]/ });
}, { noDuplicates: true });
API documentation is available here.
It can also be generated by issuing the following commands:
git clone git@github.com:marinrusu1997/thermopylae.git
cd thermopylae
yarn install
yarn workspace @thermopylae/lib.utils run doc
In the cloned repository run the following command:
yarn workspace @thermopylae/lib.utils run test
👤 Rusu Marin
Copyright © 2021 Rusu Marin.
This project is MIT licensed.