lazy-ass:惰性节点断言,不会降低性能

时间:2021-05-16 15:01:51
【文件属性】:
文件名称:lazy-ass:惰性节点断言,不会降低性能
文件大小:18KB
文件格式:ZIP
更新时间:2021-05-16 15:01:51
assertions TypeScript 懒驴 懒惰的断言,不会降低性能 注意:仅针对Node 4+进行了测试 例子 即使条件为真,常规断言也会每次评估所有参数并连接消息。 console . assert ( typeof foo === 'object' , 'expected ' + JSON . stringify ( foo , null , 2 ) + ' to be an object' ) ; 延迟断言函数评估其参数并仅在条件为假的情况下形成消息 const { lazyAss } = require ( 'lazy-ass' ) lazyAss ( typeof foo === 'object' , 'expected' , foo , 'to be an object' ) ; // shorter version const { lazyAss : la } = require ( 'lazy-a
【文件预览】:
lazy-ass-master
----.imdone()
--------config.json(834B)
----.jshintrc(2KB)
----index.html(1KB)
----src()
--------index.ts(3KB)
----.dont-break(145B)
----.travis.yml(286B)
----tsconfig.json(5KB)
----LICENSE(1KB)
----test()
--------lazy-assync.fix.js(1KB)
--------commonjs.spec.js(243B)
--------demo.js(144B)
----__tests__()
--------default-export-test.ts(384B)
--------function-test.ts(1KB)
--------lazy-ass-test.ts(3KB)
--------serialize-test.ts(1KB)
--------__snapshots__()
--------async-test.ts(407B)
----README.md(9KB)
----.npmrc(52B)
----.gitignore(37B)
----package.json(3KB)

网友评论