all files / src/ merge.ts

91.67% Statements 11/12
85.71% Branches 6/7
100% Functions 2/2
100% Lines 9/9
1 2 3 4 5 6 7 8 9 10 11 12 13  21× 16× 16× 11×   16×    
// a simple object merge function implementation
export const isobj = x => typeof x === 'object' && !Array.isArray(x) && x !== null
const merge = (o, o1) => {
	for (const k of Object.keys(o1)) {
		if (isobj(o1[k])) {
			Iif (!(k in o)) o[k] = o1[k]
			else merge(o[k], o1[k])
		} else o[k] = o1[k]
	}
	return o
}
export default merge