aboutsummaryrefslogtreecommitdiff
path: root/examples/macros
diff options
context:
space:
mode:
Diffstat (limited to 'examples/macros')
-rw-r--r--examples/macros/components/covid19.tsx11
-rw-r--r--examples/macros/components/example.jsx12
-rw-r--r--examples/macros/fetchCSV.tsx6
-rw-r--r--examples/macros/matchInFile.tsx4
-rw-r--r--examples/macros/mystery-box.ts5
5 files changed, 15 insertions, 23 deletions
diff --git a/examples/macros/components/covid19.tsx b/examples/macros/components/covid19.tsx
index 330661c82..16877b5ce 100644
--- a/examples/macros/components/covid19.tsx
+++ b/examples/macros/components/covid19.tsx
@@ -1,13 +1,10 @@
import { fetchCSV } from "macro:fetchCSV";
export const Covid19 = () => {
- const rows = fetchCSV(
- "https://covid19.who.int/WHO-COVID-19-global-data.csv",
- {
- last: 100,
- columns: ["New_cases", "Date_reported", "Country"],
- },
- );
+ const rows = fetchCSV("https://covid19.who.int/WHO-COVID-19-global-data.csv", {
+ last: 100,
+ columns: ["New_cases", "Date_reported", "Country"],
+ });
return (
<div>
diff --git a/examples/macros/components/example.jsx b/examples/macros/components/example.jsx
index 84d2d92e9..6f2760b76 100644
--- a/examples/macros/components/example.jsx
+++ b/examples/macros/components/example.jsx
@@ -5,13 +5,11 @@ export const IPAddresses = () => (
<div>
<h2>recent ip addresses</h2>
<div className="Lines">
- {matchInFile("access.log", /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}/).map(
- (ipAddress, index) => (
- <div className="Line" key={index}>
- {ipAddress}
- </div>
- ),
- )}
+ {matchInFile("access.log", /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}/).map((ipAddress, index) => (
+ <div className="Line" key={index}>
+ {ipAddress}
+ </div>
+ ))}
</div>
</div>
);
diff --git a/examples/macros/fetchCSV.tsx b/examples/macros/fetchCSV.tsx
index b06b1e03e..55a12bc42 100644
--- a/examples/macros/fetchCSV.tsx
+++ b/examples/macros/fetchCSV.tsx
@@ -36,12 +36,12 @@ export async function fetchCSV(callExpression) {
rows = rows
.slice(Math.max(limit, rows.length) - limit)
.reverse()
- .filter((columns) => columns.every(Boolean));
+ .filter(columns => columns.every(Boolean));
const value = (
<array>
- {rows.map((columns) => (
+ {rows.map(columns => (
<array>
- {columnIndices.map((columnIndex) => (
+ {columnIndices.map(columnIndex => (
<string value={columns[columnIndex]} />
))}
</array>
diff --git a/examples/macros/matchInFile.tsx b/examples/macros/matchInFile.tsx
index bd1c92dea..e434d1dec 100644
--- a/examples/macros/matchInFile.tsx
+++ b/examples/macros/matchInFile.tsx
@@ -12,10 +12,10 @@ export function matchInFile(callExpression: BunAST.CallExpression) {
<array>
{file
.split("\n")
- .map((line) => line.match(matcher))
+ .map(line => line.match(matcher))
.filter(Boolean)
.reverse()
- .map((line) => (
+ .map(line => (
<string value={line[0]} />
))}
</array>
diff --git a/examples/macros/mystery-box.ts b/examples/macros/mystery-box.ts
index 6583c9868..c686f82c3 100644
--- a/examples/macros/mystery-box.ts
+++ b/examples/macros/mystery-box.ts
@@ -6,10 +6,7 @@ export function mysteryBox(callExpression) {
const count: number = parseInt(countString, 10);
// validate
- if (!(count >= 1 && count <= 1000))
- return new Error(
- `Argument ${countString} is expected to be between 1 and 1000`,
- );
+ if (!(count >= 1 && count <= 1000)) return new Error(`Argument ${countString} is expected to be between 1 and 1000`);
// return a value
return (Math.random() * count) | 0;