
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
code-block-language-detector
Advanced tools
A lightweight Node.js package to detect the programming language of a given code snippet. Built on top of highlight.js, it supports a wide range of programming languages.
Install the package via npm:
npm install code-block-language-detector
Detect the programming language of a given code snippet:
const detectLanguage = require("code-block-language-detector");
const code = `const x = 42; console.log(x);`;
const language = detectLanguage(code);
console.log(language); // Output: 'javascript'
const detectLanguage = require("code-block-language-detector");
const code = `SELECT * FROM users WHERE age > 21;`;
const language = detectLanguage(code, ["sql", "javascript", "python"]);
console.log(language); // Output: 'sql'
If the provided code snippet is invalid or detection fails, the function returns "unknown":
const code = `+++---===`;
const language = detectLanguage(code);
console.log(language); // Output: 'unknown'
The following languages are currently supported:
FAQs
Detects the programming language of code snippets
The npm package code-block-language-detector receives a total of 0 weekly downloads. As such, code-block-language-detector popularity was classified as not popular.
We found that code-block-language-detector demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.