format-throw:使用格式化的消息引发错误并支持自定义错误类

时间:2021-05-15 04:42:33
【文件属性】:
文件名称:format-throw:使用格式化的消息引发错误并支持自定义错误类
文件大小:7KB
文件格式:ZIP
更新时间:2021-05-15 04:42:33
JavaScript 格式抛出 微小的实用程序,可使用格式化的消息引发错误,并支持自定义错误类。 安装 npm install --save format-throw 用法 var thr = require ( 'format-throw' ) ; // Throw a TypeError thr ( TypeError , '%s is not %s' , 'foo' , 'bar' ) ; // Throw a default Error thr ( 'The meaning of life is %d' , 42 ) ; // Return the error instance instead of throwing it var err1 = thr . make ( TypeError , 'meaningOfLife should be %d' , '42' ) ; var err2 = th
【文件预览】:
format-throw-master
----.eslintrc(4KB)
----Gruntfile.js(887B)
----lib()
--------format-throw.js(406B)
----.npmignore(209B)
----.travis.yml(150B)
----LICENSE(1KB)
----test()
--------.eslintrc(220B)
--------lib.spec.js(1KB)
----README.md(1KB)
----.editorconfig(188B)
----.gitignore(168B)
----index.js(63B)
----package.json(885B)

网友评论