Catch the highlights of GraphQLConf 2023! Click for recordings. Or check out our recap blog post.
Docs
Tools
Helpers

âš¡How to - @kitql/helpers

A set of helpers that can help 🫵!

Installation

npm i -D @kitql/helpers

🎨 Nice & styled logs

  • In terminal & browser (Don't think about SSR & CSR, just enjoy 🌈)
  • Very fast & very lightweight (browser)
  • out-of-the-box simple 😅

Example 1

Organize logs with SQL as prefix. (Imagine you have multiple modules)

import { green, Log, yellow } from '@kitql/helpers'
 
const logSQL = new Log('SQL')
 
logSQL.info(`Check out the ${yellow(`yellow`)} information`)
logSQL.info(`Or the ${green(`green`)} one!`)

💤 Sleep

You want to wait a bit? Just sleep for x ms.

await sleep(5000)

👋 stringify

import { stry } from '@kitql/helpers'
 
const obj = { value: 7 }
 
stry(obj) // same as JSON.stringify(obj, null, 2)

Are 2 objects equal? (deep compare)

import { stryEq } from '@kitql/helpers'
 
const obj1 = { value: 7 }
const obj2 = { value: 6 }
 
strEq(obj1, obj2) // false