Skip to content

Commit 7f4884f

Browse files
committed
Formatting
1 parent b91d0ea commit 7f4884f

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

packages/core/__tests__/consolidated.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ describe("withConsolidated", () => {
5252
it("loads chunk data from underlying store", async () => {
5353
let root = path.join(__dirname, "../../../fixtures/v2/data.zarr");
5454
let store = await withConsolidated(new FileSystemStore(root));
55-
let entry = store.contents().find((x) => x.path === "/3d.chunked.mixed.i2.C")!;
55+
let entry = store.contents().find((x) =>
56+
x.path === "/3d.chunked.mixed.i2.C"
57+
)!;
5658
let grp = await open(store, { kind: "group" });
5759
let arr = await open(grp.resolve(entry.path), { kind: entry.kind });
5860
expect(arr).toBeInstanceOf(ZarrArray);

packages/core/src/consolidated.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { json_decode_object, json_encode_object } from "./util.js";
33
import type {
44
ArrayMetadata,
55
ArrayMetadataV2,
6+
Attributes,
67
GroupMetadata,
78
GroupMetadataV2,
8-
Attributes,
99
} from "./metadata.js";
1010

1111
type ConsolidatedMetadata = {
@@ -65,7 +65,9 @@ export async function withConsolidated<Store extends Readable>(
6565
.catch(() => ({}));
6666

6767
return {
68-
async get(...args: Parameters<Store["get"]>): Promise<Uint8Array | undefined> {
68+
async get(
69+
...args: Parameters<Store["get"]>
70+
): Promise<Uint8Array | undefined> {
6971
let [key, opts] = args;
7072
if (known_meta[key]) {
7173
return json_encode_object(known_meta[key]);
@@ -78,19 +80,18 @@ export async function withConsolidated<Store extends Readable>(
7880
return maybe_bytes;
7981
},
8082
contents(): { path: AbsolutePath; kind: "array" | "group" }[] {
81-
let contents: { path: AbsolutePath, kind: "array" | "group" }[] = [];
83+
let contents: { path: AbsolutePath; kind: "array" | "group" }[] = [];
8284
for (let [key, value] of Object.entries(known_meta)) {
8385
let parts = key.split("/");
8486
let filename = parts.pop()!;
85-
let path = parts.join("/") as AbsolutePath;
86-
if (!path.startsWith("/")) path = `/${path}`;
87+
let path = (parts.join("/") || "/") as AbsolutePath;
8788
if (filename === ".zarray") contents.push({ path, kind: "array" });
8889
if (filename === ".zgroup") contents.push({ path, kind: "group" });
8990
if (is_v3(value)) {
9091
contents.push({ path, kind: value.node_type });
9192
}
9293
}
9394
return contents;
94-
}
95+
},
9596
};
9697
}

0 commit comments

Comments
 (0)