https://github.com/midwayjs/debugger
Currency Debug
https://github.com/midwayjs/debugger
Last synced: over 1 year ago
JSON representation
Currency Debug
- Host: GitHub
- URL: https://github.com/midwayjs/debugger
- Owner: midwayjs
- License: mit
- Created: 2020-04-01T03:31:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-05-30T07:09:35.000Z (about 4 years ago)
- Last Synced: 2025-02-14T19:36:38.316Z (over 1 year ago)
- Language: TypeScript
- Size: 27.3 KB
- Stars: 1
- Watchers: 17
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
# debugger
通用的 debug 包裹,让一个方法有了单步调试的能力,可以用在 cli 等情况下支持 `--debug` 参数启动单步调试。
### Usage
```sh
npm i @midwayjs/debugger --save
```
```ts
// function.ts
import { debugWrapper } from '@midwayjs/debugger';
export const fun = async (arg1, arg2) => {
await new Promise(resolve => setTimeout(resolve, 1000));
return arg1 + arg2;
}
export const wrapFun = debugWrapper({
file: __filename, // 要包裹的方法所在文件
export: 'fun', // 要包裹的方法的方法名
debug: process.env.DEBUG // 是否开启debug,true即开启
});
```
## License
[MIT](http://github.com/midwayjs/debugger/blob/master/LICENSE)