From e03373d0c24734f55d1b260d3dc46e419adb87c8 Mon Sep 17 00:00:00 2001 From: Antonio Stoilkov Date: Wed, 8 Jan 2025 16:47:05 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20improve=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 409d7f2..8661ba8 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ npm install console-powers ## Usage -The library can be mentally split in two: **1)** `ii()` that aims to replace `console.log` + `tt()` that aims to replace `console.table`, **2)** the core API that allows doing advanced printing in the browser console. This is a getting started for **1)**. For **2)** see [API section](#api). +The library can be mentally split in two: *1)* `ii()` that aims to replace `console.log` + `tt()` that aims to replace `console.table`, *2)* the core API that allows doing advanced printing in the browser console. This is a getting started for *1)*. For *2)* see [API section](#api). 1. Add `ii` and `tt` to the global scope so you can use it anywhere without importing it – just like `console.log`: ```ts @@ -36,7 +36,7 @@ The library can be mentally split in two: **1)** `ii()` that aims to replace `co ``` 2. Use anywhere instead of `console.log` and `console.table`: ```ts - // ii() returns the first parameter you pass to it, so you can use it inline + // use inline — ii() returns the first arg you pass to it const markdownTree = ii(await worker.parseMarkdownTree()) ``` @@ -214,14 +214,19 @@ tt.pre = (value: unknown): unknown => { } ``` -### `addToGlobalScope()` +
+

console-powers/global

+ +#### `addToGlobalScope()` Imported from `console-powers/global`. It adds `ii` and `tt` and it's TypeScript types to the global scope so you can use it anywhere without importing it – just like `console.log`. -### `addNoopToGlobalScope()` +#### `addNoopToGlobalScope()` Imported from `console-powers/global`. It adds empty/noop functions for `ii` and `tt` so if you accidentally forget a `ii` or `tt` call during development it won't crash in production. +
+

consoleInspect()