dumper
所属分类:JavaScript/JQuery
开发工具:JavaScript
文件大小:0KB
下载次数:0
上传日期:2023-06-01 13:32:30
上 传 者:
sh-1993
说明: 一个更好、更漂亮的Node.js应用程序变量检查器,
(A better and pretty variable inspector for your Node.js applications,)
文件列表:
.editorconfig (329, 2023-06-01)
.eslintignore (16, 2023-06-01)
.eslintrc (1043, 2023-06-01)
.npmignore (6, 2023-06-01)
.nvmrc (7, 2023-06-01)
.prettierrc (201, 2023-06-01)
.travis.yml (86, 2023-06-01)
LICENSE.md (1136, 2023-06-01)
Makefile (55, 2023-06-01)
__test__/ (0, 2023-06-01)
__test__/dumper.test.js (4286, 2023-06-01)
__test__/index.test.js (753, 2023-06-01)
index.js (98, 2023-06-01)
logo.svg (1811, 2023-06-01)
package.json (1001, 2023-06-01)
src/ (0, 2023-06-01)
src/dd.js (398, 2023-06-01)
src/dump.js (382, 2023-06-01)
src/dumper.js (4152, 2023-06-01)
yarn.lock (167933, 2023-06-01)
Dumper.js
dumper.js
is a better and pretty variable inspector for your Node.js applications.
## Installation
```bash
npm install --save-dev dumper.js
# or you may use yarn
yarn add dumper.js --dev
```
## Usage
### `dd()` Dump and Die
Calling `dd()` prints the output and kills the process
```js
const { dd } = require('dumper.js');
const users = [
{ user: 'barney', age: 36, active: true, createdAt: new Date(), getAge: () => this.age },
{ user: 'fred', age: 40, active: false, createdAt: new Date(), getAge: () => this.age },
{ user: 'pebbles', age: 1, active: true, createdAt: new Date(), getAge: () => this.age }
];
dd(users);
// Above variable will be printed
console.log('this will never be called');
```
Will output below result and kill the process. [Demo](https://runkit.com/ziishaned/5cc95de6c01d42001ae5eed5)
![dd](https://i.imgur.com/iKIel4s.png)
### `dump()` Dump and Continue
Calling `dump()` prints the output and continues with the processing
```js
const { dump } = require('dumper.js');
const users = [
{ user: 'barney', age: 36, active: true, createdAt: new Date(), getAge: () => this.age },
{ user: 'fred', age: 40, active: false, createdAt: new Date(), getAge: () => this.age },
{ user: 'pebbles', age: 1, active: true, createdAt: new Date(), getAge: () => this.age }
];
dump(users);
// Above variable will be printed and the process will continue
console.log('this will be called');
```
Will output below result and continue processing. [Demo](https://runkit.com/ziishaned/5cc95f368838bf001bb9a6b1)
![dump](https://i.imgur.com/x048cf6.png)
## Contributions
Feel free to submit pull requests, create issues or spread the word.
## License
MIT © [Zeeshan Ahmad](https://twitter.com/ziishaned)
近期下载者:
相关文件:
收藏者: