
Research
/Security News
Weaponizing Discord for Command and Control Across npm, PyPI, and RubyGems.org
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
filter-console
Advanced tools
Filter out unwanted
console.log()
output
Can be useful when you don't control the output, for example, filtering out PropType warnings from a third-party React component.
$ npm install filter-console
import filterConsole from 'filter-console';
const disableFilter = filterConsole(['🐼']);
const log = () => {
console.log('');
console.log('🦄');
console.log('🐼');
console.log('🐶');
};
log();
disableFilter();
log();
$ node example.js
🦄
🐶
🦄
🐼
🐶
Returns a function, which when called, disables the filter.
Type: Array<string | RegExp | Function>
Console output that matches any of the given patterns are filtered from being logged. The patterns are matched against what would be logged and not the console
method input arguments directly. Meaning an exclude pattern of 'foo bar'
will match console.log('foo %s', 'bar')
.
Filter types:
string
: Checks if the string pattern is included in the console output.RegExp
: Checks if the RegExp pattern matches the console output.Function
: Receives the console output as a string and is expected to return a truthy/falsy value of whether to exclude it.Type: object
Type: string[]
Default: ['log', 'debug', 'info', 'warn', 'error']
Console methods to filter.
Type: object
Default: console
Use a custom console
object. Can be useful for testing or mocking.
FAQs
Filter out unwanted `console.log()` output
The npm package filter-console receives a total of 87,425 weekly downloads. As such, filter-console popularity was classified as popular.
We found that filter-console 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.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.
Security News
Socket now integrates with Bun 1.3’s Security Scanner API to block risky packages at install time and enforce your organization’s policies in local dev and CI.
Research
The Socket Threat Research Team is tracking weekly intrusions into the npm registry that follow a repeatable adversarial playbook used by North Korean state-sponsored actors.