feat(core): Moving Renderer3 into @angular/core (#20855)
PR Close #20855
This commit is contained in:

committed by
Igor Minar

parent
bc66d27938
commit
0fa818b318
24
packages/core/src/render3/node_assert.ts
Normal file
24
packages/core/src/render3/node_assert.ts
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {assertEqual, assertNotEqual} from './assert';
|
||||
import {LNode, LNodeFlags} from './interfaces';
|
||||
|
||||
export function assertNodeType(node: LNode, type: LNodeFlags) {
|
||||
assertNotEqual(node, null, 'node');
|
||||
assertEqual(node.flags & LNodeFlags.TYPE_MASK, type, 'Node.type', typeSerializer);
|
||||
}
|
||||
|
||||
|
||||
function typeSerializer(type: LNodeFlags): string {
|
||||
if (type == LNodeFlags.Projection) return 'Projection';
|
||||
if (type == LNodeFlags.Container) return 'Container';
|
||||
if (type == LNodeFlags.View) return 'View';
|
||||
if (type == LNodeFlags.Element) return 'Element';
|
||||
return '??? ' + type + ' ???';
|
||||
}
|
Reference in New Issue
Block a user