Files
30-seconds-of-code/node_modules/relay-runtime/lib/isRelayModernEnvironment.js
2019-08-20 15:52:05 +02:00

24 lines
705 B
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
* @format
*/
'use strict';
/**
* Determine if a given value is an object that implements the `Environment`
* interface defined in `RelayStoreTypes`.
*
* Use a sigil for detection to avoid a realm-specific instanceof check, and to
* aid in module tree-shaking to avoid requiring all of RelayRuntime just to
* detect its environment.
*/
function isRelayModernEnvironment(environment) {
return Boolean(environment && environment['@@RelayModernEnvironment']);
}
module.exports = isRelayModernEnvironment;