Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@astropub/flow
Advanced tools
Astro Flow lets you use components to control flow in Astro.
The <For>
component loops over iterable objects like Array, Map, Set, and so on.
---
import { For } from '@astropub/flow'
---
<For of={items}>{item => <h2>{item.title}</h2>}</For>
The iterate()
function provides the same functionality as a utility.
---
import { iterate } from '@astropub/flow'
---
{iterate(items, item => <h2>{item.title}</h2>)}
The <When>
component renders if the given conditions are truthy.
---
import { When } from '@astropub/flow'
---
<When test1={checkForTruthiness} test2={alsoCheckForTruthiness}>
<p>Everything was Truthy!</p>
<Fragment slot="else">
<p>Not everything was truthy...</p>
</Fragment>
</When>
The <Switch>
component evaluates an expression and renders the <Case>
component that matches the expression's value.
---
import { Switch, Case } from '@astropub/flow'
---
<Switch of={null}>
<Case of={true}>
<h1>Positive</h1>
<h2>Truly Positive</h2>
</Case>
<Case of={false}>
<h1>Negative</h1>
<h2>Really Negative</h2>
</Case>
<Case default>
<h1>Default</h1>
<h2>Definitely Default</h2>
</Case>
</Switch>
Add Astro Flow to your project.
npm install @astropub/flow
Use Astro Flow in your project.
---
import { Case, For, Switch } from '@astropub/flow'
---
<For of={items}>{
(item) => <h2>{item.title}</h2>
}</For>
<When test={true}>
<p>Things are true.</p>
</When>
<Switch of={null}>
<Case of={true}>
<h1>Positive</h1>
<h2>Truly Positive</h2>
</Case>
<Case of={false}>
<h1>Negative</h1>
<h2>Really Negative</h2>
</Case>
<Case default>
<h1>Default</h1>
<h2>Definitely Default</h2>
</Case>
</Switch>
Enjoy!
Want to learn more? Read the Astro documentation or jump into the Astro Discord.
FAQs
Use components to control flow in Astro
We found that @astropub/flow 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.