Sha256: 0bf82e4ab8503414dd0b113d3cedf6e980fc641127441b1638455a867e5a36ec

Contents?: true

Size: 795 Bytes

Versions: 12

Compression:

Stored size: 795 Bytes

Contents

/**
 * Assign properties from `props` to `obj`
 * @template O, P The obj and props types
 * @param {O} obj The object to copy properties to
 * @param {P} props The object to copy properties from
 * @returns {O & P}
 */
export function assign(obj, props) {
	for (let i in props) obj[i] = props[i];
	return /** @type {O & P} */ (obj);
}

/**
 * Check if two objects have a different shape
 * @param {object} a
 * @param {object} b
 * @returns {boolean}
 */
export function shallowDiffers(a, b) {
	for (let i in a) if (i !== '__source' && !(i in b)) return true;
	for (let i in b) if (i !== '__source' && a[i] !== b[i]) return true;
	return false;
}

export function removeNode(node) {
	let parentNode = node.parentNode;
	if (parentNode) parentNode.removeChild(node);
}

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
isomorfeus-preact-10.6.14 node_modules/preact/compat/src/util.js
isomorfeus-preact-10.6.13 node_modules/preact/compat/src/util.js
isomorfeus-preact-10.6.12 node_modules/preact/compat/src/util.js
isomorfeus-preact-10.6.11 node_modules/preact/compat/src/util.js
isomorfeus-preact-10.6.10 node_modules/preact/compat/src/util.js
isomorfeus-preact-10.6.9 node_modules/preact/compat/src/util.js
isomorfeus-preact-10.6.8 node_modules/preact/compat/src/util.js
isomorfeus-preact-10.6.7 node_modules/preact/compat/src/util.js
isomorfeus-preact-10.6.6 node_modules/preact/compat/src/util.js
isomorfeus-preact-10.6.5 node_modules/preact/compat/src/util.js
isomorfeus-preact-10.6.4 node_modules/preact/compat/src/util.js
isomorfeus-preact-10.6.3 node_modules/preact/compat/src/util.js