MCPcopy
hub / github.com/heroku/react-refetch / connectFactory

Function connectFactory

src/components/connect.js:21–55  ·  view source on GitHub ↗
(defaults = {}, options = {})

Source from the content-addressed store, hash-verified

19let nextVersion = 0
20
21function 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
57export default connectFactory({
58 headers: {

Callers 1

connect.jsFile · 0.85

Calls 1

checkTypesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…