1.0.1 ā€¢ Published 2 years ago

@thermopylae/lib.utils v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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 git@github.com: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

šŸ“ License

Copyright Ā© 2021 Rusu Marin. This project is MIT licensed.