From 0819c74a7f9d52e9c3263fd96300ddde1ca151ca Mon Sep 17 00:00:00 2001 From: Ezra Lalonde Date: Wed, 18 Oct 2017 23:19:49 -0600 Subject: [PATCH] Format constructor's `option` as table (#109) It's easier to scan readme when options are table instead of list. --- README.md | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 8062a56..bf3e8f7 100644 --- a/README.md +++ b/README.md @@ -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)`