Skip to content

Commit

Permalink
fix(convert): remove unnecessary method
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenybai committed Mar 10, 2022
1 parent 4372968 commit fa7a3ea
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions packages/shared/convert.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,6 @@
import { DOMNode, Flags, OLD_VNODE_FIELD, VNode, VProps } from '../million/types';
import { DOMNode, OLD_VNODE_FIELD, VNode, VProps } from '../million/types';
import { h } from './h';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const fromNodeToVNode = (node: any): VNode => {
const vnode =
node.type === 'tag'
? h(node.name, node.attribs, ...node.children.map(fromNodeToVNode))
: node.type === 'text'
? node.data
: '';

if (vnode.props?.ignore !== undefined && vnode.props?.ignore !== null) {
vnode.flag = Flags.IGNORE_NODE;
}

return vnode;
};

export const fromDomNodeToVNode = (el: DOMNode): VNode | undefined => {
if (el[OLD_VNODE_FIELD]) return el[OLD_VNODE_FIELD];
if (el instanceof Text) return String(el.nodeValue);
Expand Down

0 comments on commit fa7a3ea

Please sign in to comment.