Skip to content

Commit

Permalink
docs: fix example for import map so it uses correct syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud committed Aug 7, 2024
1 parent d2c8746 commit 345d3e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ const client = new Eik({
await client.load();

const maps = client.maps();
const combined = maps
.map((map) => map.imports)
.reduce((map, acc) => ({ ...acc, ...map }), {});
const combined = maps.reduce((map, acc) => ({ ...acc, ...map }), {});

const html = `
<script type="importmap">
Expand Down
10 changes: 5 additions & 5 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,9 @@ tap.test("Client - Load maps", async (t) => {
"Should return maps",
);

const combined = maps
.map((map) => map.imports)
.reduce((map, acc) => ({ ...acc, ...map }), {});
const combined = maps.reduce((map, acc) => ({ ...acc, ...map }), {});

t.same(combined, { eik: "/src/eik.js" });
t.same(combined, { imports: { eik: "/src/eik.js" } });

const html = `<script type="importmap">
${JSON.stringify(combined, null, 2)}
Expand All @@ -270,7 +268,9 @@ ${JSON.stringify(combined, null, 2)}
html,
`<script type="importmap">
{
"eik": "/src/eik.js"
"imports": {
"eik": "/src/eik.js"
}
}
</script>`,
);
Expand Down

0 comments on commit 345d3e1

Please sign in to comment.