vinjsutils
v1.0.6
Published
bunch of useful utility functions
Downloads
2
Maintainers
Readme
vinjsutils
Bunch of useful JavaScript utility functions
npm install vinjsutils
printTable
Example usage:
import { printTable } from 'vinjsutils';
const customers = [
{
id: 1,
first_name: 'Devonne',
last_name: 'Tomalin',
gender: 'Female',
email: '[email protected]',
phone: '829-180-2277',
},
{
id: 2,
first_name: 'Nehemiah',
last_name: 'Kobu',
gender: 'Male',
email: '[email protected]',
phone: '700-790-2424',
},
{
id: 3,
first_name: 'Darrelle',
last_name: 'Duffrie',
gender: 'Female',
email: '[email protected]',
phone: '591-446-8117',
},
];
printTable(customers);
Output:
+----+------------+-----------+--------+-----------------------+--------------+
| id | first_name | last_name | gender | email | phone |
|----|------------|-----------|--------|-----------------------|--------------|
| 1 | Devonne | Tomalin | Female | [email protected] | 829-180-2277 |
| 2 | Nehemiah | Kobu | Male | [email protected] | 700-790-2424 |
| 3 | Darrelle | Duffrie | Female | [email protected] | 591-446-8117 |
+----+------------+-----------+--------+-----------------------+--------------+
printObject
Example usage:
import { printObject } from 'vinjsutils';
const data = {
id: 1,
name: 'Alice',
age: 25,
hobbies: ['reading', 'hiking', 'cooking'],
address: {
street: '123 Main St',
city: 'Wonderland',
postalCode: '12345',
nestedObject: {
key1: 'value1',
key2: 'value2',
},
},
};
printObject(data);