Installations
npm install clear-require
Developer Guide
Typescript
No
Module System
N/A
Min. Node Version
>=4
Node Version
8.12.0
NPM Version
6.4.1
Score
71.2
Supply Chain
84.4
Quality
74.6
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (97.98%)
TypeScript (2.02%)
Developer
sindresorhus
Download Statistics
Total Downloads
1,855,298
Last Day
271
Last Week
1,582
Last Month
7,575
Last Year
127,662
GitHub Statistics
181 Stars
29 Commits
25 Forks
9 Watching
1 Branches
7 Contributors
Bundle Size
1.23 kB
Minified
598.00 B
Minified + Gzipped
Package Meta Information
Latest Version
3.0.0
Package Id
clear-require@3.0.0
Size
1.80 kB
NPM Version
6.4.1
Node Version
8.12.0
Publised On
08 Nov 2018
Total Downloads
Cumulative downloads
Total Downloads
1,855,298
Last day
-28.9%
271
Compared to previous day
Last week
-36.3%
1,582
Compared to previous week
Last month
9.9%
7,575
Compared to previous month
Last year
-24.2%
127,662
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
clear-require
Clear a module from the
require
cache
Useful for testing purposes when you need to freshly require
a module.
Install
$ npm install --save clear-require
Usage
1// foo.js 2let i = 0; 3module.exports = () => ++i;
1const clearRequire = require('clear-require'); 2 3require('./foo')(); 4//=> 1 5 6require('./foo')(); 7//=> 2 8 9clearRequire('./foo'); 10 11require('./foo')(); 12//=> 1
API
clearRequire(moduleId)
moduleId
Type: string
What you would use with require()
.
clearRequire.all()
Clear all modules from the require
cache.
clearRequire.match(regex)
Clear all matching modules from the require
cache.
regex
Type: RegExp
Regex to match against the module ID's.
Related
- require-uncached - Require a module bypassing the cache
License
MIT © Sindre Sorhus
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
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 7/29 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
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/clear-module/main.yml/main?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/sindresorhus/clear-module/main.yml/main?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/main.yml:23
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/main.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
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
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 7 are checked with a SAST tool
Score
3.6
/10
Last Scanned on 2025-01-20
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