UNPKG

syphonx-core

Version:

SyphonX is a template-driven solution for extracting data from HTML in a highly efficient way. It combines the power of jQuery, Regular Expressions, and Javascript into a declarative template-driven format that extracts and reshapes HTML data into JSON.

21 lines 605 B
import { isObject } from "./is.js"; export function merge(source, target) { if (source instanceof Array && target instanceof Array) { return [...source, ...target]; } else if (isObject(source) && isObject(target)) { const obj = {}; const keys = Array.from(new Set([...Object.keys(source), ...Object.keys(target)])); for (const key of keys) { obj[key] = merge(source[key], target[key]); } return obj; } else if (target) { return target; } else { return source; } } //# sourceMappingURL=merge.js.map