Sha256: 8ee71787c4aa2dc91e7b59f53c002dbdcaf1142e2d496b202b2141678500ffe2

Contents?: true

Size: 850 Bytes

Versions: 69

Compression:

Stored size: 850 Bytes

Contents

import { EMPTY_ARR } from "./constants";

/**
 * 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) {
	// @ts-ignore We change the type of `obj` to be `O & P`
	for (let i in props) obj[i] = props[i];
	return /** @type {O & P} */ (obj);
}

/**
 * Remove a child node from its parent if attached. This is a workaround for
 * IE11 which doesn't support `Element.prototype.remove()`. Using this function
 * is smaller than including a dedicated polyfill.
 * @param {Node} node The node to remove
 */
export function removeNode(node) {
	let parentNode = node.parentNode;
	if (parentNode) parentNode.removeChild(node);
}

export const slice = EMPTY_ARR.slice;

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
isomorfeus-preact-10.6.30 node_modules/preact/src/util.js
isomorfeus-preact-10.6.29 node_modules/preact/src/util.js
isomorfeus-preact-10.6.28 node_modules/preact/src/util.js
isomorfeus-preact-10.6.27 node_modules/preact/src/util.js
isomorfeus-preact-10.6.26 node_modules/preact/src/util.js
isomorfeus-preact-10.6.25 node_modules/preact/src/util.js
isomorfeus-preact-10.6.24 node_modules/preact/src/util.js
isomorfeus-preact-10.6.23 node_modules/preact/src/util.js
isomorfeus-preact-10.6.22 node_modules/preact/src/util.js
isomorfeus-preact-10.6.21 node_modules/preact/src/util.js
isomorfeus-preact-10.6.20 node_modules/preact/src/util.js
isomorfeus-preact-10.6.19 node_modules/preact/src/util.js
isomorfeus-preact-10.6.18 node_modules/preact/src/util.js
isomorfeus-preact-10.6.17 node_modules/preact/src/util.js
isomorfeus-preact-10.6.16 node_modules/preact/src/util.js
isomorfeus-preact-10.6.15 node_modules/preact/src/util.js
isomorfeus-preact-10.6.2 node_modules/preact/src/util.js
isomorfeus-preact-10.6.1 node_modules/preact/src/util.js
isomorfeus-preact-10.6.0 node_modules/preact/src/util.js
isomorfeus-preact-10.5.11 node_modules/preact/src/util.js