mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 14:19:11 +03:00
* add cms turbo app * add cms scripts to package.json * update README * update README * update files * fix formatting * fix populateAuthors * sync dependencies * update launch week field * update lint config * Coordinate the deps to be the same as the other apps. * Remove extra files. * Run prettier on the CMS files. * Add commands for cleaning and typechecking. * Fix weird version of @types/react in docs. * run pnpm install * fix pnpm-lock * fix cms lint --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
35 lines
781 B
TypeScript
35 lines
781 B
TypeScript
// @ts-nocheck
|
|
|
|
/**
|
|
* Simple object check.
|
|
* @param item
|
|
* @returns {boolean}
|
|
*/
|
|
export function isObject(item: unknown): item is object {
|
|
return typeof item === 'object' && !Array.isArray(item)
|
|
}
|
|
|
|
/**
|
|
* Deep merge two objects.
|
|
* @param target
|
|
* @param ...sources
|
|
*/
|
|
export default function deepMerge<T, R>(target: T, source: R): T {
|
|
const output = { ...target }
|
|
if (isObject(target) && isObject(source)) {
|
|
Object.keys(source).forEach((key) => {
|
|
if (isObject(source[key])) {
|
|
if (!(key in target)) {
|
|
Object.assign(output, { [key]: source[key] })
|
|
} else {
|
|
output[key] = deepMerge(target[key], source[key])
|
|
}
|
|
} else {
|
|
Object.assign(output, { [key]: source[key] })
|
|
}
|
|
})
|
|
}
|
|
|
|
return output
|
|
}
|