@wildhog/consolas
v1.1.1
Published
Adds useful Console methods to Google Apps Script
Downloads
11
Maintainers
Readme
Adds useful Console methods to Google Apps Script
Getting Started
ConsolAS
can be used as a native Apps Script library, as an NPM module or simply copied and pasted into your code.
As a Native Google Apps Script Library
Import the following script ID as a library into your Google Apps Script project:
18Wk4wG7DGRGvy39zZbWhkU37z6ytqW06QkSwUlZHlIClQXHmCtEFucvD
Initiate ConsoleAS
:
const cx = ConsolAS.init();
As an NPM module
Install by running:
npm i @wildhog/consolas
Import and initiate ConsolAS
:
import { ConsolAS } from 'consolas';
const cx = new ConsolAS();
By Copying and Pasting the Code from the dist/copy-paste/consolas.js
File
The IIFE in the dist/copy-paste/consolas.js
returns a class and stores it in the ConsolAS
variable. Hence you only need to initiate the said class:
const cx = new ConsolAS();
API
ConsolAS
works with two-dimensional arrays and objects.
Example 1:
cx.table([
['Name', 'Profession'],
['John Doe', 'Developer'],
['Jane Doe', 'Designer'],
['Jim Doe', 'Artist'],
]);
This prints out:
| (index) | 0 | 1 |
| ------- | -------- | ---------- |
| 0 | Name | Profession |
| 1 | John Doe | Developer |
| 2 | Jane Doe | Designer |
| 3 | Jim Doe | Artist |
Example 2:
cx.table({
name: 'John Doe',
profession: 'Developer',
age: 30,
city: 'Anytown',
});
This prints out:
| (index) | Value |
| ---------- | --------- |
| name | John Doe |
| profession | Developer |
| age | 30 |
| city | Anytown |
Example 3:
cx.table([
{
name: 'Alice',
age: 30,
},
{
name: 'Bob',
age: 25,
},
{
name: 'Charlie',
age: 35,
},
{
name: 'Diana',
age: 28,
},
]);
This prints out:
| (index) | name | age |
| ------- | ------- | --- |
| 0 | Alice | 30 |
| 1 | Bob | 25 |
| 2 | Charlie | 35 |
| 3 | Diana | 28 |
Supported Methods
Currently only the table(TwoDimArray|Object)
method works. Other methods will follow soon. Check CONTRIBUTING if you are interest in implementing them.
Run tests
npm t
See Also
Author
- 👤 Dmitry Kostyuk
- Wurkspaces.dev
- Medium
- Stack Overflow
Show your support
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator