
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.
@lvce-editor/test-syntax-highlighting
Advanced tools
Utility package for testing syntax highlighting functions for the lvce-editor.
Utility package for testing syntax highlighting functions for the lvce-editor.
$ npm install @lvce-editor/test-syntax-highlighting
Create an extension manifest:
{
"id": "language-basics-xyz",
"languages": [
{
"id": "xyz",
"extensions": [".xyz"],
"tokenize": "src/tokenizeXyz.js"
}
]
}
Then create the tokenize function
// src/tokenizeXyz.js
export const TokenType = {
Text: 1,
}
export const TokenMap = {
[TokenType.Text]: 'Text',
}
export const initialLineState = {
state: 1,
tokens: [],
}
export const hasArrayReturn = true
export const tokenizeLine = (line) => {
const tokens = [TokenType.Text, line.length]
return {
state: 1,
tokens,
}
}
Then add sample code into test/cases/sample-code.xyz
sample xyz code
Then a test script to your package json file
{
"scripts": {
"test": "test-syntax-highlighting"
}
}
Then run npm test
which will create test/baselines/sample-code.txt
. That file contains the tokens that were generated by the tokenizeLine function for test/cases/sample-code.xyz
:
Text
When the tests succeed, you will get output similar to this:
> test-syntax-highlighting
1 test passed in 4ms
When a test fails, you will get output similar to this:
mismatch sample-code
1 test failed, 0 tests passed
When that happens, you need can either
test/baselines/sample-code.txt
ortest/baselines/sample-code.txt
and rerun npm test
to regenerate the expected tokens in test/baselines/sample-code.txt
FAQs
Utility package for testing syntax highlighting functions for the lvce-editor.
The npm package @lvce-editor/test-syntax-highlighting receives a total of 17 weekly downloads. As such, @lvce-editor/test-syntax-highlighting popularity was classified as not popular.
We found that @lvce-editor/test-syntax-highlighting 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.