
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
extends assert of node 扩展node原生的Assert功能
Usage for English is Coming soon...
使用nodejs
$ npm install --save assertrue
const assert = require('assertrue');
- 说明:assertrue中已经包含原生assert的全部功能,不需要再额外引入assert
isTrue(actual, [message])assert.isTrue(true); //ok
assert.isTrue(1); //ok
assert.isTrue('a'); //ok
assert.isTrue(false); //AssertionError
assert.isTrue(0); //AssertionError
assert.isTrue(''); //AssertionError
isStrictTrue(actual, [message])assert.isStrictTrue(true); //ok
assert.isStrictTrue(1); //AssertionError
assert.isStrictTrue('a'); //AssertionError
assert.isStrictTrue(false); //AssertionError
assert.isStrictTrue(0); //AssertionError
assert.isStrictTrue(''); //AssertionError
isFalse(actual, [message])isStrictFalse(actual, [message])isNaN(actual, [message])assert.isNaN(NaN); //ok
assert.isNaN('a'); //ok
assert.isNaN({}); //ok
assert.isNaN(1); //AssertionError
assert.isNaN('1'); //AssertionError
assert.isNaN(true); //AssertionError
isStrictNaN(actual, [message])assert.isStrictNaN(NaN); //ok
assert.isStrictNaN('a'); //AssertionError
assert.isStrictNaN({}); //AssertionError
assert.isStrictNaN(1); //AssertionError
assert.isStrictNaN('1'); //AssertionError
assert.isStrictNaN(true); //AssertionError
isNotNaN(actual, [message])isNotStrictNaN(actual, [message])isStrictString(actual, [message])assert.isStrictString('a'); //ok
isNotStrictString(actual, [message])isStrictArray(actual, [message])assert.isStrictString(['a']); //ok
isNotStrictArray(actual, [message])isStrictFunction(actual, [message])assert.isStrictFunction(()=>{}); //ok
isNotStrictFunction(actual, [message])isStrictRegExp(actual, [message])assert.isStrictRegExp(/\w+/ig); //ok
isNotStrictRegExp(actual, [message])isStrictBoolean(actual, [message])assert.isStrictBoolean(true); //ok
isNotStrictBoolean(actual, [message])isStrictNumber(actual, [message])assert.isStrictNumber(1); //ok
isNotStrictNumber(actual, [message])is(actual, expectedType, [message])assert.is(1, Number); //ok
assert.is(1, 'Number'); //ok
class Super {}
class Sub extends Super {}
assert.is(new Sub(), Sub); //ok
assert.is(new Sub(), Super); //ok
assert.is(new Super(), Super); //ok
assert.is(new Super(), Sub); //AssertionError
assert.is(new Sub(), 'Super'); //AssertionError
isNot(actual, expectedType, [message])isAssignableFrom(superType, subType, [message])class Super {}
class Sub extends Super {}
assert.isAssignableFrom(Super, Sub); //ok
assert.isAssignableFrom(Super, Super); //ok
assert.isAssignableFrom(Sub, Sub); //ok
assert.isAssignableFrom(Sub, Super); //AssertionError
isNotAssignableFrom(superType, subType, [message])isAssignableTo(subType, superType, [message])class Super {}
class Sub extends Super {}
assert.isAssignableFrom(Sub, Super); //ok
assert.isAssignableFrom(Super, Super); //ok
assert.isAssignableFrom(Sub, Sub); //ok
assert.isAssignableFrom(Super, Sub); //AssertionError
isNotAssignableTo(subType, superType, [message])增加对class继承关系的断言
重命名为assertrue
增加 Travis CI 支持
新增对各种类型的断言
正式启动项目
More docs and examples, to be continue... 更多接口文档的案例,未完待补充...
FAQs
extends assert of node
We found that assertrue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.