How to use the metal.isObject function in metal

To help you get started, we’ve selected a few metal 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 metal / metal.js / packages / metal-component / src / events / events.js View on Github external
function extractListenerInfo_(component, value) {
	const info = {
		fn: value
	};
	if (isObject(value) && !isFunction(value)) {
		info.selector = value.selector;
		info.fn = value.fn;
	}
	if (isString(info.fn)) {
		info.fn = getComponentFn(component, info.fn);
	}
	return info;
}
github metal / metal.js / packages / metal-soy / src / Soy.js View on Github external
toIncDom(value) {
		if (isObject(value) && isString(value.content) && (value.contentKind === 'HTML')) {
			value = value.content;
		}
		if (isString(value)) {
			value = HTML2IncDom.buildFn(value);
		}
		return value;
	}
}
github LiferayCloud / magnet / src / plugin / function.js View on Github external
const isMultiple = module => {
  return isObject(module.route) && module.route.multiple;
};
github metal / metal.js / packages / metal-web-component / src / define_web_component.js View on Github external
export function defineWebComponent(tagName, Ctor) {
	if (!('customElements' in window)) {
		return;
	}

	let observedAttributes = Object.keys(State.getStateStatic(Ctor));

	const props = getStaticProperty(Ctor, 'PROPS', mergeState);

	const hasProps = isObject(props) && Object.keys(props).length;

	if (hasProps) {
		observedAttributes = Object.keys(props);
	}

	/**
	 * Custom Element wrapper for Metal components.
	 *
	 * @constructor
	 * @extends HTMLElement
	 */
	function CustomElement() {
		return Reflect.construct(HTMLElement, [], CustomElement);
	}

	CustomElement.observedAttributes = observedAttributes;
github metal / metal.js / packages / metal-state / src / State.js View on Github external
shouldInformChange_(name, prevVal) {
		const info = this.getStateInfo(name);
		return (info.state === State.KeyStates.INITIALIZED) &&
			(isObject(prevVal) || prevVal !== this.get(name));
	}
github metal / metal.js / packages / metal-dom / src / domNamed.js View on Github external
export function toggleClasses(element, classes) {
	if (!isObject(element) || !isString(classes)) {
		return;
	}

	if ('classList' in element) {
		toggleClassesWithNative_(element, classes);
	} else {
		toggleClassesWithoutNative_(element, classes);
	}
}
github LiferayCloud / marble / packages / marble-autocomplete / src / Autocomplete.js View on Github external
value: function(item) {
      if (core.isString(item)) {
        item = {
          textPrimary: item,
        };
      }
      if (core.isObject(item) && !item.text) {
        item.text = item.textPrimary;
      }
      return item;
    },
  },
github metal / metal.js / packages / metal-component / src / Component.js View on Github external
validatorEventsFn_(val) {
		return !isDefAndNotNull(val) || isObject(val);
	}
}