Installations
npm install @gerhobbelt/better-assert
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=4
Node Version
8.11.1
NPM Version
5.6.0
Score
68.8
Supply Chain
85.7
Quality
74.9
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (95.41%)
Makefile (4.59%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
visionmedia
Download Statistics
Total Downloads
679
Last Day
2
Last Week
7
Last Month
15
Last Year
79
GitHub Statistics
290 Stars
25 Commits
24 Forks
9 Watching
1 Branches
7 Contributors
Bundle Size
1.14 kB
Minified
621.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.0.3-3
Package Id
@gerhobbelt/better-assert@1.0.3-3
Unpacked Size
8.80 kB
Size
3.79 kB
File Count
9
NPM Version
5.6.0
Node Version
8.11.1
Total Downloads
Cumulative downloads
Total Downloads
679
Last day
0%
2
Compared to previous day
Last week
133.3%
7
Compared to previous week
Last month
150%
15
Compared to previous month
Last year
-30.1%
79
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
4
better-assert
Better c-style assertions for self-documenting failure messages.
Note: This forked version adds support for simple error messages.
Installation
$ npm install git://github.com/tobius/better-assert.git
Example
By default assertions are enabled, however the NO_ASSERT environment variable will deactivate them when truthy.
1var assert = require('better-assert'); 2 3test(); 4 5function test() { 6 var user = { name: 'toby' }; 7 assert('toby' == user.name); 8 assert('number' == typeof user.age, 'user age must be a number'); 9} 10 11AssertionError: ('number' == typeof user.age) user age must be a number 12 at test (/Users/tj/projects/better-assert/example.js:9:3) 13 at Object.<anonymous> (/Users/tj/projects/better-assert/example.js:4:1) 14 at Module._compile (module.js:449:26) 15 at Object.Module._extensions..js (module.js:467:10) 16 at Module.load (module.js:356:32) 17 at Function.Module._load (module.js:312:12) 18 at Module.runMain (module.js:492:10) 19 at process.startup.processNextTick.process._tickCallback (node.js:244:9)
Browser support
See this fork for use in the browser: https://github.com/devinrhode2/better-assert-browser
License
(The MIT License)
Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 6/23 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 8 are checked with a SAST tool
Score
3.3
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More