Installations
npm install assert
Score
91.9
Supply Chain
91.9
Quality
81.5
Maintenance
100
Vulnerability
100
License
Developer
browserify
Developer Guide
Module System
CommonJS
Min. Node Version
Typescript Support
No
Node Version
20.6.0
NPM Version
9.8.1
Statistics
300 Stars
199 Commits
59 Forks
9 Watching
4 Branches
37 Contributors
Updated on 27 Nov 2024
Bundle Size
47.24 kB
Minified
13.33 kB
Minified + Gzipped
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
3,756,333,140
Last day
-10.2%
2,416,818
Compared to previous day
Last week
2.4%
14,492,597
Compared to previous week
Last month
14.2%
58,639,022
Compared to previous month
Last year
-0.2%
650,636,507
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
assert
The
assert
module from Node.js, for the browser.
With browserify, simply require('assert')
or use the assert
global and you will get this module.
The goal is to provide an API that is as functionally identical to the Node.js assert
API as possible. Read the official docs for API documentation.
Install
To use this module directly (without browserify), install it as a dependency:
npm install assert
Inconsistencies with Node.js assert
Due to differences between browsers, some error properties such as message
and stack
will be inconsistent. However the assertion behaviour is as close as possible to Node.js and the same error code
will always be used.
Usage with bundlers that don't automatically include polyfills for Node.js APIs
Bundlers like webpack 5
and Vite.js
(and possibly others) don't automatically include polyfills for Node.js APIs. Like most packages on npm, this module depends on other Node.js APIs, so it won't work with these bundlers without also including a polyfill for the process
Node.js global. You can use this library to polyfill the process
global.
Note that this is not a flaw in this package - this package will work without any manual configuration with browserify
and webpack 4
and other working bundlers. Unfortunately, some bundlers decided to require an explicit allow-list of all Node.js API specific packages instead of having them work out of the box, hence the incompatibility. See https://github.com/browserify/commonjs-assert/issues/55 for some more context.
Contributing
To contribute, work on the source files. Then build and run the tests against the built files. Be careful to not introduce syntax that will be transpiled down to unsupported syntax. For example, for...of
loops will be transpiled to use Symbol.iterator
which is unavailable in IE.
Build scripts
npm run build
Builds the project into the build
dir.
npm run dev
Watches source files for changes and rebuilds them into the build
dir.
npm run test
Builds the source files into the build
dir and then runs the tests against the built project.
npm run test:nobuild
Runs the tests against the built project without rebuilding first.
This is useful if you're debugging in the transpiled code and want to re-run the tests without overwriting any changes you may have made.
npm run test:source
Runs the tests against the unbuilt source files.
This will only work on modern Node.js versions.
npm run test:browsers
Run browser tests against the all targets in the cloud.
Requires airtap credentials to be configured on your machine.
npm run test:browsers:local
Run a local browser test server. No airtap configuration required.
When paired with npm run dev
any changes you make to the source files will be automatically transpiled and served on the next request to the test server.
License
MIT © Joyent, Inc. and other Node contributors
No vulnerabilities found.
Reason
security policy file detected
Details
- Info: security policy file detected: .github/SECURITY.md:1
- Info: Found linked content: .github/SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: .github/SECURITY.md:1
- Info: Found text in security policy: .github/SECURITY.md:1
Reason
no dangerous workflow patterns detected
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 4/22 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/rebase.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/browserify/commonjs-assert/rebase.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/rebase.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/browserify/commonjs-assert/rebase.yml/main?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/require-allow-edits.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/browserify/commonjs-assert/require-allow-edits.yml/main?enable=pin
- Info: 0 out of 1 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 third-party GitHubAction dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/node-aught.yml:1
- Warn: no topLevel permission defined: .github/workflows/node-pretest.yml:1
- Warn: no topLevel permission defined: .github/workflows/node-tens.yml:1
- Warn: no topLevel permission defined: .github/workflows/rebase.yml:1
- Warn: no topLevel permission defined: .github/workflows/require-allow-edits.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
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 'main'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 12 are checked with a SAST tool
Score
4.2
/10
Last Scanned on 2024-11-25
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