@thermopylae/lib.utils
v1.0.1
Published
Utility functions.
Downloads
33
Maintainers
Readme
Utility functions.
Install
npm install @thermopylae/lib.utils
Description
This package contains a collection of utility functions grouped into different categories, such as chrono, string, token, array etc.
Usage
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 Reference
API documentation is available here.
It can also be generated by issuing the following commands:
git clone [email protected]:marinrusu1997/thermopylae.git
cd thermopylae
yarn install
yarn workspace @thermopylae/lib.utils run doc
Run tests
In the cloned repository run the following command:
yarn workspace @thermopylae/lib.utils run test
Author
👤 Rusu Marin
- GitHub: @marinrusu1997
- Email: [email protected]
- LinkedIn: @marinrusu1997
📝 License
Copyright © 2021 Rusu Marin. This project is MIT licensed.