(defaults = {}, options = {})
| 19 | let nextVersion = 0 |
| 20 | |
| 21 | function connectFactory(defaults = {}, options = {}) { |
| 22 | function connectImpl(map, deprecatedOptionsArgument = {}) { |
| 23 | let finalOptions = options |
| 24 | if ('withRef' in deprecatedOptionsArgument) { |
| 25 | warning(false, 'The options argument is deprecated in favor of `connect.options()`. In a future release, support will be removed.') |
| 26 | finalOptions = Object.assign({}, options, { withRef: deprecatedOptionsArgument.withRef }) |
| 27 | } |
| 28 | |
| 29 | warning(!(Function.prototype.isPrototypeOf(defaults.buildRequest) && |
| 30 | Function.prototype.isPrototypeOf(defaults.Request)), |
| 31 | 'Both buildRequest and Request were provided in `connect.defaults()`. ' + |
| 32 | 'However, this custom Request would only be used in the default buildRequest.' |
| 33 | ) |
| 34 | |
| 35 | warning(options.pure === undefined, '`pure` option is no longer supported') |
| 36 | |
| 37 | return connect(map, defaults, finalOptions) |
| 38 | } |
| 39 | |
| 40 | connectImpl.defaults = function (overrides = {}) { |
| 41 | checkTypes(overrides) |
| 42 | return connectFactory(Object.assign( |
| 43 | {}, |
| 44 | defaults, |
| 45 | overrides, |
| 46 | { headers: Object.assign({}, defaults.headers, overrides.headers) } |
| 47 | ), options) |
| 48 | } |
| 49 | |
| 50 | connectImpl.options = function (overrides = {}) { |
| 51 | return connectFactory(defaults, Object.assign({}, options, overrides)) |
| 52 | } |
| 53 | |
| 54 | return connectImpl |
| 55 | } |
| 56 | |
| 57 | export default connectFactory({ |
| 58 | headers: { |
no test coverage detected
searching dependent graphs…