
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Make your function buffer calls till you flush.
Useful to make Backtrace logging.
npm install fn-buffer
new BufferedFunction(fn, opts)
fn
<function>(required)
The function to buffer calls ofopts
[number|object]
Options or capacity
opts.capacity
[number=10]
Capacity of the ring-buffer of the callsopts.flush
[boolean|number=capacity]
Auto-flush when buffer gets fullopts.reverse
[boolean]
Reverse the order of buffer callsimport BufferedFunction from 'fn-buffer'
const bufferedLog = new BufferedFunction(console.log);
bufferedLog('a')
bufferedLog('b')
bufferedLog('c')
bufferedLog('d')
bufferedLog('e')
/* Doesn't log anything yet */
bufferedLog.flush();
/* Logs everything at once */
This can be used to create backtrace-logging:
import BufferedFunction from 'fn-buffer'
export const debug = BufferedFunction(console.debug, { flush: false })
process.on('uncaughtExceptionMonitor', debug.flush)
This debug
function will only log to console in the event of an uncaughtException
.
See backtrace-logging for a module that does exactly this.
FAQs
Buffer function calls till you flush
The npm package fn-buffer receives a total of 1 weekly downloads. As such, fn-buffer popularity was classified as not popular.
We found that fn-buffer 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
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.