@aws-amplify/core
Version:
Core category of aws-amplify
21 lines (19 loc) • 754 B
JavaScript
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
/**
* 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).
*/
const 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' &&
AMPLIFY_CONTEXT_BRAND in value);
}
export { AMPLIFY_CONTEXT_BRAND, isAmplifyContext };
//# sourceMappingURL=contextBrand.mjs.map