UNPKG

834 BJavaScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 *
8 * @format
9 */
10// flowlint ambiguous-object-type:error
11'use strict';
12/**
13 * Determine if a given value is an object that implements the `Environment`
14 * interface defined in `RelayEnvironmentTypes`.
15 */
16
17function isRelayEnvironment(environment) {
18 return typeof environment === 'object' && environment !== null && // TODO: add applyMutation/sendMutation once ready in both cores
19 typeof environment.check === 'function' && typeof environment.lookup === 'function' && typeof environment.retain === 'function' && typeof environment.execute === 'function' && typeof environment.subscribe === 'function';
20}
21
22module.exports = isRelayEnvironment;
\No newline at end of file