
Research
Supply Chain Attack on Axios Pulls Malicious Dependency from npm
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.
Tagged template function to write readable multi-line strings with embedded if-else conditions and automatic dedentation
f-strings provides a tagged template f that allows you to write readable multi-line strings with embedded if-else conditions and automatic dedentation.
npm install f-strings
Use If, Else, and EndIf expressions to include conditional content.
import { f, If, Else, EndIf } from 'f-strings';
const history = [
{ role: 'user', content: 'Hello' },
{ role: 'assistant', content: 'Hi there!' },
];
const question = 'What is the capital of France?';
const prompt = f`
You are a helpful assistant.
${If(history.length)}
Conversation history:
${history.map((msg) => `- ${msg.role}: ${msg.content}`)}
${Else}
No conversation history.
${EndIf}
User question:
${question}
`;
console.log(message);
You are a helpful assistant.
Conversation history:
- user: Hello
- assistant: Hi there!
User question:
What is the capital of France?
Strips indentation from multi-line strings.
import { f, If, EndIf } from 'f-strings';
const prompt = f`
Hello
World!
How are you?
I'm good, thank you!
`;
console.log(dedented);
Hello
World!
How are you?
I'm good, thank you!
Expressions can be lazily evaluated, so you can use functions to generate content only when needed.
import { f, If, EndIf } from 'f-strings';
const messages = await getMessages();
const prompt = f`
${If(messages.length)}
You have ${messages.length} messages:
${() => messages.map((msg) => `- ${msg}`)}
${Else}
No messages.
${EndIf}
`;
console.log(prompt);
You have 1000 messages:
- Message 1
- Message 2
...
- Message 1000
f - Tagged Template Functionf`template ${value} string`
If(condition) - Conditional BlockStarts a conditional block. Includes the following content if the condition is truthy.
const text = f`
${If(condition)}
content when true
${EndIf}
`;
Else() - Alternative BlockStarts an alternative block. Includes the following content if the condition is falsy.
![NOTE]
Elsecan be used without calling it as a function:${Else}or${Else()}.
const text = f`
${If(condition)}
content when true
${Else}
content when false
${EndIf}
`;
EndIf - End ConditionalMarks the end of a conditional block. Required for every If.
![NOTE]
EndIfcan be used without calling it as a function:${EndIf}or${EndIf()}.
MIT
FAQs
Tagged template function to write readable multi-line strings with embedded if-else conditions and automatic dedentation
The npm package f-strings receives a total of 166 weekly downloads. As such, f-strings popularity was classified as not popular.
We found that f-strings demonstrated a healthy version release cadence and project activity because the last version was released less than 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
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.

Security News
TeamPCP is partnering with ransomware group Vect to turn open source supply chain attacks on tools like Trivy and LiteLLM into large-scale ransomware operations.