@bryancm/nj-utilities
v1.1.0
Published
This is a collection of utility functions for JavaScript and Node.js. You can use them in your projects to simplify common tasks and improve code readability.
Maintainers
Readme
nj-utilities
This is a collection of utility functions for JavaScript and Node.js. You can use them in your projects to simplify common tasks and improve code readability. You'll find actions for:
- array
- date
- object
- etc
Also, there's some defined values for regex and common messages and values for requests.
Instructions
Installation
$ npm install @bryancm/nj-utilitiesor
$ yarn add @bryancm/nj-utilitiesUsage
After adding the library in your project you can use any of the functionalities listed below:
- Builders
- logger
- Const Values
- regex
- Enums
- activated-field-values
- console-text-colors
- log-level
- server-message
- Helpers
- array-helper
- date-helper
- email-helper
- numeric-helper
- object-helper
- string-helper
- values-helper
- Interfaces
- logger-file-config
- logger
- Services
- console-logger
- file-logger
- logger
For example, within the values-helper file you can find a good function to get the values prepared for a WHERE-IN SQL Condition. The name of that function is getValuesPreparedForWhereClauseWithIn and the usage is like:
console.log(getValuesPreparedForWhereClauseWithIn([1, 2, 3, 4, 5, 6]));
// Output: 1, 2, 3, 4, 5, 6And, it can be something like:
const values = getValuesPreparedForWhereClauseWithIn([1, 2, 3, 4, 5, 6]);
const query = `SELECT name, age FROM people WHERE id IN (${values})`;
console.log(query);
// Output: SELECT name, age FROM people WHERE id IN (1, 2, 3, 4, 5, 6)