Skip to content

Commit

Permalink
Format constructor's option as table (graphql#109)
Browse files Browse the repository at this point in the history
It's easier to scan readme when options are table instead of list.
  • Loading branch information
ezralalonde authored and leebyron committed Oct 19, 2017
1 parent 03772a9 commit 0819c74
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,22 +279,13 @@ Create a new `DataLoader` given a batch loading function and options.

- *options*: An optional object of options:

- *batch*: Default `true`. Set to `false` to disable batching, instead
immediately invoking `batchLoadFn` with a single load key.

- *maxBatchSize*: Default `Infinity`. Limits the number of items that get
passed in to the `batchLoadFn`.

- *cache*: Default `true`. Set to `false` to disable memoization caching,
instead creating a new Promise and new key in the `batchLoadFn` for every
load of the same key.

- *cacheKeyFn*: A function to produce a cache key for a given load key.
Defaults to `key => key`. Useful to provide when JavaScript objects are keys
and two similarly shaped objects should be considered equivalent.

- *cacheMap*: An instance of [Map][] (or an object with a similar API) to be
used as the underlying cache for this loader. Default `new Map()`.
| Option Key | Type | Default | Description |
| ---------- | ---- | ------- | ----------- |
| *batch* | Boolean | `true` | Set to `false` to disable batching, invoking `batchLoadFn` with a single load key.
| *maxBatchSize* | Number | `Infinity` | Limits the number of items that get passed in to the `batchLoadFn`.
| *cache* | Boolean | `true` | Set to `false` to disable memoization caching, creating a new Promise and new key in the `batchLoadFn` for every load of the same key.
| *cacheKeyFn* | Function | `key => key` | Produces cache key for a given load key. Useful when objects are keys and two objects should be considered equivalent.
| *cacheMap* | Object | `new Map()` | Instance of [Map][] (or an object with a similar API) to be used as cache.

##### `load(key)`

Expand Down

0 comments on commit 0819c74

Please sign in to comment.