How to use the inferno-shared.isUndefined function in inferno-shared

To help you get started, we’ve selected a few inferno-shared examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github infernojs / inferno / packages / inferno-server / src / renderToString.queuestream.ts View on Github external
const flags = vNode.flags;
    const type = vNode.type;
    const props = vNode.props || EMPTY_OBJ;
    const children = vNode.children;

    // Handles a component render
    if ((flags & VNodeFlags.Component) > 0) {
      const isClass = flags & VNodeFlags.ComponentClass;
      // Render the
      if (isClass) {
        const instance = new type(props, context);
        const hasNewAPI = Boolean(type.getDerivedStateFromProps);
        instance.$BS = false;
        instance.$SSR = true;
        let childContext;
        if (!isUndefined(instance.getChildContext)) {
          childContext = instance.getChildContext();
        }
        if (!isNullOrUndef(childContext)) {
          context = combineFrom(context, childContext);
        }
        if (instance.props === EMPTY_OBJ) {
          instance.props = props;
        }
        instance.context = context;
        // Trigger lifecycle hook
        if (!hasNewAPI && isFunction(instance.componentWillMount)) {
          instance.$BR = true;
          instance.componentWillMount();
          const pending = instance.$PS;

          if (pending) {
github infernojs / inferno / packages / inferno-hyperscript / src / index.ts View on Github external
function parseTag(tag: string | null, props: any): string {
  if (!tag) {
    return "div";
  }
  const noId = props && isUndefined(props.id);
  const tagParts = tag.split(classIdSplit);
  let tagName: null | string = null;

  if (notClassId.test(tagParts[1])) {
    tagName = "div";
  }
  let classes;

  for (let i = 0, len = tagParts.length; i < len; i++) {
    const part = tagParts[i];

    if (!part) {
      continue;
    }
    const type = part.charAt(0);
github infernojs / inferno / packages / inferno / src / DOM / recycling.ts View on Github external
export function recycleComponent(vNode: VNode, lifecycle: LifecycleClass, context: Object, isSVG: boolean) {
	const type = vNode.type as Function;
	const pools: Pools|undefined = componentPools.get(type);

	if (!isUndefined(pools)) {
		const key = vNode.key;
		const pool = key === null ? pools.nonKeyed : pools.keyed.get(key);

		if (!isUndefined(pool)) {
			const recycledVNode = pool.pop();

			if (!isUndefined(recycledVNode)) {
				const flags = vNode.flags;
				const failed = patchComponent(
					recycledVNode,
					vNode,
					null,
					lifecycle,
					context,
					isSVG,
					(flags & VNodeFlags.ComponentClass) > 0,
					true
				);

				if (!failed) {
					return vNode.dom;
				}
			}
github infernojs / inferno / packages / inferno / src / DOM / recycling.ts View on Github external
export function recycleElement(vNode: VNode, lifecycle: LifecycleClass, context: Object, isSVG: boolean) {
	const tag = vNode.type as string | null;
	const pools: Pools|undefined = elementPools.get(tag);

	if (!isUndefined(pools)) {
		const key = vNode.key;
		const pool = key === null ? pools.nonKeyed : pools.keyed.get(key);

		if (!isUndefined(pool)) {
			const recycledVNode = pool.pop();

			if (!isUndefined(recycledVNode)) {
				patchElement(recycledVNode, vNode, null, lifecycle, context, isSVG, true);
				return vNode.dom;
			}
		}
	}
	return null;
}
github infernojs / inferno / packages / inferno / src / DOM / recycling.ts View on Github external
const hooks = vNode.ref as Refs;
	const nonRecycleHooks = hooks && (
			hooks.onComponentWillMount ||
			hooks.onComponentWillUnmount ||
			hooks.onComponentDidMount ||
			hooks.onComponentWillUpdate ||
			hooks.onComponentDidUpdate
		);
	if (nonRecycleHooks) {
		return;
	}
	const type = vNode.type;
	const key = vNode.key;
	let pools: Pools|undefined = componentPools.get(type as Function);

	if (isUndefined(pools)) {
		pools = {
			keyed: new Map(),
			nonKeyed: []
		};
		componentPools.set(type as Function, pools);
	}
	if (isNull(key)) {
		pools.nonKeyed.push(vNode);
	} else {
		let pool = pools.keyed.get(key);

		if (isUndefined(pool)) {
			pool = [];
			pools.keyed.set(key, pool);
		}
		pool.push(vNode);
github infernojs / inferno / packages / inferno / src / DOM / recycling.ts View on Github external
export function recycleElement(vNode: VNode, lifecycle: LifecycleClass, context: Object, isSVG: boolean) {
	const tag = vNode.type as string | null;
	const pools: Pools|undefined = elementPools.get(tag);

	if (!isUndefined(pools)) {
		const key = vNode.key;
		const pool = key === null ? pools.nonKeyed : pools.keyed.get(key);

		if (!isUndefined(pool)) {
			const recycledVNode = pool.pop();

			if (!isUndefined(recycledVNode)) {
				patchElement(recycledVNode, vNode, null, lifecycle, context, isSVG, true);
				return vNode.dom;
			}
		}
	}
	return null;
}
github infernojs / inferno / packages / inferno / src / DOM / recycling.ts View on Github external
export function recycleElement(vNode: VNode, lifecycle: LifecycleClass, context: Object, isSVG: boolean) {
	const tag = vNode.type as string | null;
	const pools: Pools|undefined = elementPools.get(tag);

	if (!isUndefined(pools)) {
		const key = vNode.key;
		const pool = key === null ? pools.nonKeyed : pools.keyed.get(key);

		if (!isUndefined(pool)) {
			const recycledVNode = pool.pop();

			if (!isUndefined(recycledVNode)) {
				patchElement(recycledVNode, vNode, null, lifecycle, context, isSVG, true);
				return vNode.dom;
			}
		}
	}
	return null;
}
github infernojs / inferno / packages / inferno / src / DOM / recycling.ts View on Github external
const key = vNode.key;
	let pools: Pools|undefined = componentPools.get(type as Function);

	if (isUndefined(pools)) {
		pools = {
			keyed: new Map(),
			nonKeyed: []
		};
		componentPools.set(type as Function, pools);
	}
	if (isNull(key)) {
		pools.nonKeyed.push(vNode);
	} else {
		let pool = pools.keyed.get(key);

		if (isUndefined(pool)) {
			pool = [];
			pools.keyed.set(key, pool);
		}
		pool.push(vNode);
	}
}