Skip to content

Commit a2ab3b0

Browse files
authored
camelCase (#83)
1 parent d0e36df commit a2ab3b0

File tree

14 files changed

+288
-212
lines changed

14 files changed

+288
-212
lines changed

.changeset/itchy-paws-accept.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@zarrita/indexing": patch
3+
"@zarrita/ndarray": patch
4+
"@zarrita/core": patch
5+
---
6+
7+
feat: prefer camelCase for public API

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const store = new FetchStore("http://localhost:8080/data.zarr");
2323
const arr = await zarr.open.v2(store, { kind: "array" }); // zarr.Array<DataType, FetchStore>
2424

2525
// read chunk
26-
const chunk = await arr.get_chunk([0, 0]);
26+
const chunk = await arr.getChunk([0, 0]);
2727

2828
// Option 1: Builtin getter, no dependencies
2929
import { get, slice } from "@zarrita/indexing";
@@ -34,7 +34,7 @@ import { get } from "@zarrita/ndarray";
3434
const full = await get(arr); // ndarray.Ndarray<Int32Array>
3535

3636
// read region
37-
const region = await get(arr, [null, zarr.slice(6)]);
37+
const region = await get(arr, [null, slice(6)]);
3838
```
3939

4040
### Zarr building blocks

docs/get-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const arr = await zarr.open.v2(store, { kind: "array" });
1313
## Read a chunk
1414

1515
```js
16-
const chunk = await arr.get_chunk([0, 0]);
16+
const chunk = await arr.getChunk([0, 0]);
1717
// {
1818
// data: Int32Array(10) [
1919
// 0, 1, 2, 3, 4,

docs/recipes.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const arr = await zarr.open(store, { kind: "array" });
1111

1212
arr; // zarr.Array<DataType, FetchStore>
1313
arr.shape; // [5, 10]
14-
arr.chunk_shape; // [2, 5]
14+
arr.chunks; // [2, 5]
1515
arr.dtype; // "int32"
1616
```
1717

@@ -74,8 +74,8 @@ import { FileSystemStore } from "@zarrita/storage";
7474
const store = new FileSystemStore("tempstore");
7575
const arr = await zarr.create(store, {
7676
shape: [10, 10],
77-
chunk_shape: [5, 5],
78-
data_type: "int32",
77+
chunks: [5, 5],
78+
dtype: "int32",
7979
});
8080
arr; // zarr.Array<"int32", FileSystemStore>
8181
```

packages/core/__tests__/create.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import * as zarr from "../src/index.js";
44
import { json_decode_object } from "../src/util.js";
55

66
test("create root group", async () => {
7-
let h = zarr.root();
87
let attributes = { hello: "world" };
9-
let grp = await zarr.create(h, { attributes });
8+
let grp = await zarr.create(new Map(), { attributes });
109
expect(grp.path).toBe("/");
1110
expect(await grp.attrs()).toStrictEqual(attributes);
12-
expect(h.store.has("/zarr.json")).true;
13-
expect(json_decode_object(h.store.get("/zarr.json")!)).toMatchInlineSnapshot(`
11+
expect(grp.store.has("/zarr.json")).true;
12+
expect(json_decode_object(grp.store.get("/zarr.json")!))
13+
.toMatchInlineSnapshot(`
1414
{
1515
"attributes": {
1616
"hello": "world",
@@ -34,7 +34,7 @@ test("create array", async () => {
3434
expect(a.path).toBe("/arthur/dent");
3535
expect(a.shape).toStrictEqual([5, 10]);
3636
expect(a.dtype).toBe("int32");
37-
expect(a.chunk_shape).toStrictEqual([2, 5]);
37+
expect(a.chunks).toStrictEqual([2, 5]);
3838
expect(await a.attrs()).toStrictEqual(attributes);
3939
expect(json_decode_object(h.store.get("/arthur/dent/zarr.json")!))
4040
.toMatchInlineSnapshot(`

packages/core/__tests__/hierarchy.test.ts

+2-9
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,21 @@ describe("Array", () => {
3737
let arr = new Array(new Map(), "/", array_metadata);
3838
expect({
3939
shape: arr.shape,
40-
chunk_shape: arr.chunk_shape,
40+
chunks: arr.chunks,
4141
dtype: arr.dtype,
42-
fill_value: arr.fill_value,
4342
attrs: await arr.attrs(),
4443
path: arr.path,
45-
codec: arr.codec,
4644
store: arr.store,
4745
}).toMatchInlineSnapshot(`
4846
{
4947
"attrs": {
5048
"answer": 42,
5149
},
52-
"chunk_shape": [
50+
"chunks": [
5351
5,
5452
5,
5553
],
56-
"codec": {
57-
"decode": [Function],
58-
"encode": [Function],
59-
},
6054
"dtype": "int8",
61-
"fill_value": 0,
6255
"path": "/",
6356
"shape": [
6457
10,

0 commit comments

Comments
 (0)