https://github.com/progfay/playground
Framework to tasting something with Node.js 😋
https://github.com/progfay/playground
playground
Last synced: 2 months ago
JSON representation
Framework to tasting something with Node.js 😋
- Host: GitHub
- URL: https://github.com/progfay/playground
- Owner: progfay
- License: apache-2.0
- Created: 2020-07-29T13:04:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T20:40:18.000Z (almost 3 years ago)
- Last Synced: 2025-03-18T05:40:43.997Z (9 months ago)
- Topics: playground
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@progfay/playground
- Size: 127 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @progfay/playground
Framework to tasting something with Node.js 😋
## Installation
[](https://www.npmjs.com/package/@progfay/playground)
```sh
npm i -D @progfay/playground
```
## 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
```js
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'))
})
})
})
```
[](https://gyazo.com/d5860beba56967039616f3435abcf891)
## 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`