UNPKG

@aws-amplify/core

Version:
27 lines (22 loc) 741 B
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 import { documentExists, processExists, windowExists } from './helpers'; // Tested with @angular/core 16.0.0 export function angularWebDetect() { const angularVersionSetInDocument = Boolean( documentExists() && document.querySelector('[ng-version]') ); const angularContentSetInWindow = Boolean( // @ts-ignore windowExists() && typeof window['ng'] !== 'undefined' ); return angularVersionSetInDocument || angularContentSetInWindow; } export function angularSSRDetect() { return ( (processExists() && typeof process.env === 'object' && process.env['npm_lifecycle_script']?.startsWith('ng ')) || false ); }