mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
10 lines
260 B
JavaScript
10 lines
260 B
JavaScript
export const undefinedToNull = list => {
|
|
const resolvers = {}
|
|
list.forEach(key => {
|
|
resolvers[key] = async (parent, params, context, resolveInfo) => {
|
|
return typeof parent[key] === 'undefined' ? null : parent[key]
|
|
}
|
|
})
|
|
return resolvers
|
|
}
|