Skip to content

gavinning/assert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

assert

断言,失败信息支持携带err-code

Install

npm i @4a/assert

Usage

const assert = require('@4a/assert')

try {
    assert.ok(0, 100, 'error code 100')
}
catch(err) {
    console.log({
        code: err.code,
        message: err.message
    })
}

try {
    assert.fail(1, 200, 'error code 200')
}
catch(err) {
    console.log({
        code: err.code,
        message: err.message
    })
}

About

断言,失败信息支持携带err-code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published