1.0.6 • Published 1 year ago

vinjsutils v1.0.6

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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: 'dtomalin0@360.cn',
    phone: '829-180-2277',
  },
  {
    id: 2,
    first_name: 'Nehemiah',
    last_name: 'Kobu',
    gender: 'Male',
    email: 'nkobu1@hibu.com',
    phone: '700-790-2424',
  },
  {
    id: 3,
    first_name: 'Darrelle',
    last_name: 'Duffrie',
    gender: 'Female',
    email: 'dduffrie2@storify.com',
    phone: '591-446-8117',
  },
];
printTable(customers);

Output:

+----+------------+-----------+--------+-----------------------+--------------+
| id | first_name | last_name | gender | email                 | phone        |
|----|------------|-----------|--------|-----------------------|--------------|
| 1  | Devonne    | Tomalin   | Female | dtomalin0@360.cn      | 829-180-2277 |
| 2  | Nehemiah   | Kobu      | Male   | nkobu1@hibu.com       | 700-790-2424 |
| 3  | Darrelle   | Duffrie   | Female | dduffrie2@storify.com | 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);
1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago