1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | 'use strict';
|
12 |
|
13 | var invariant = require("fbjs/lib/invariant");
|
14 |
|
15 | var isRelayEnvironment = require('./isRelayEnvironment');
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | function assertRelayContext(relay) {
|
22 | !isRelayContext(relay) ? process.env.NODE_ENV !== "production" ? invariant(false, 'RelayContext: Expected `context.relay` to be an object conforming to ' + 'the `RelayContext` interface, got `%s`.', relay) : invariant(false) : void 0;
|
23 | return relay;
|
24 | }
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | function isRelayContext(context) {
|
32 | return typeof context === 'object' && context !== null && !Array.isArray(context) && isRelayEnvironment(context.environment);
|
33 | }
|
34 |
|
35 | module.exports = {
|
36 | assertRelayContext: assertRelayContext,
|
37 | isRelayContext: isRelayContext
|
38 | }; |
\ | No newline at end of file |