@aws-amplify/core
Version:
Core category of aws-amplify
24 lines (22 loc) • 873 B
JavaScript
;
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
Object.defineProperty(exports, "__esModule", { value: true });
exports.AMPLIFY_CONTEXT_BRAND = void 0;
exports.isAmplifyContext = isAmplifyContext;
/**
* Symbol brand used to identify {@link AmplifyContext} objects at runtime.
* Uses `Symbol.for()` so the brand is shared across module instances
* (e.g. when `@aws-amplify/core` is accidentally duplicated in the bundle).
*/
exports.AMPLIFY_CONTEXT_BRAND = Symbol.for('amplify.context');
/**
* Returns `true` if the given value is a branded {@link AmplifyContext}.
*/
function isAmplifyContext(value) {
return (value !== null &&
value !== undefined &&
typeof value === 'object' &&
exports.AMPLIFY_CONTEXT_BRAND in value);
}
//# sourceMappingURL=contextBrand.js.map