Skip to content

Commit 77375f4

Browse files
committed
Minor improvement of comments
1 parent 32d664f commit 77375f4

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/index.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,23 @@
1212
// of values or Errors.
1313
type BatchLoadFn<K, V> = (keys: Array<K>) => Promise<Array<V | Error>>;
1414

15+
// Optionally turn off batching or caching or provide a cache key function or a
16+
// custom cache instance.
17+
type Options<K, V> = {
18+
batch?: boolean;
19+
cache?: boolean;
20+
cacheKeyFn?: (key: any) => any;
21+
cacheMap?: CacheMap<K, Promise<V>>;
22+
};
23+
24+
// If a custom cache is provided, it must be of this type (a subset of ES6 Map).
1525
type CacheMap<K, V> = {
1626
get(key: K): V | void;
1727
set(key: K, value: V): any;
1828
delete(key: K): any;
1929
clear(): any;
2030
};
2131

22-
// Optionally turn off batching or caching or provide a cache key function or a
23-
// custom cache instance.
24-
type Options<K, V> = {
25-
batch?: boolean,
26-
cache?: boolean,
27-
cacheMap?: CacheMap<K, Promise<V>>,
28-
cacheKeyFn?: (key: any) => any
29-
};
30-
3132
/**
3233
* A `DataLoader` creates a public API for loading data from a particular
3334
* data back-end with unique keys such as the `id` column of a SQL table or
@@ -285,7 +286,7 @@ function failedDispatch<K, V>(
285286

286287
// Private
287288
type LoaderQueue<K, V> = Array<{
288-
key: K,
289-
resolve: (value: V) => void,
290-
reject: (error: Error) => void
291-
}>
289+
key: K;
290+
resolve: (value: V) => void;
291+
reject: (error: Error) => void;
292+
}>;

0 commit comments

Comments
 (0)