@progfay/playground
TypeScript icon, indicating that this package has built-in type declarations

1.0.0Β β€’Β PublicΒ β€’Β Published

@progfay/playground

Framework to tasting something with Node.js πŸ˜‹

Features

  • Display playground result in hierarchical structure
  • Grouping some playground functions
  • Support async function
  • Provide same API as Console Object
  • Keep color highlighting of log

Syntax

play((group, run) => {
  group('grouping', (group, run) => {
    run('execute playground', console => {
      console.log('yummy πŸ˜‹')
    })

    run('async function', async console => {
      console.log('sleep start')
      await sleep(1000)
      console.log('sleep end')
    })

    run('keep coloring', async console => {
      console.log(new Date('2020-01-01'))
    })
  })
})

Image from Gyazo

API

play(nest, opts): void

  • Start playgrounds
  • No support for multiple play function call
  • Exported type: play: Play

nest: (group, run) => void

  • Exported type: nest: Nest
group: (name, nest) => void
  • Group some playgrounds or sub-groups
  • Exported type: group: Group
name: string
  • Name of group which is groupd
nest: Nest
  • nest behaves like first argument of play
run: (name, func) => void
  • Name of single playground function
  • Exported type: run: Run
func: (console) => void
  • Single playground function
  • First argument console is Console Object
  • Exported type: func: Func

Readme

Keywords

Package Sidebar

Install

npm i @progfay/playground

Weekly Downloads

1

Version

1.0.0

License

Apache-2.0

Unpacked Size

36.4 kB

Total Files

39

Last publish

Collaborators

  • progfay