Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

perf: use enum for node types #43

Merged
merged 1 commit into from
May 9, 2024
Merged

perf: use enum for node types #43

merged 1 commit into from
May 9, 2024

Conversation

chiefcll
Copy link
Contributor

@chiefcll chiefcll commented May 9, 2024

No description provided.

@chiefcll chiefcll merged commit ec19ccc into main May 9, 2024
1 check passed

export default function (node: ElementNode): boolean {
const children = [];
let hasOrder = false;
for (let i = 0; i < node.children.length; i++) {
const c = node.children[i]!;
// Filter empty text nodes which are place holders for <Show> and elements missing dimensions
if (c.name === 'TextNode') {
if (c.type === NodeTypes.Text) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A string union would have been slightly more efficient as you'd have kept `c.type === 'TextNode'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants