mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 10:21:55 +00:00
13 lines
310 B
TypeScript
13 lines
310 B
TypeScript
/**
|
|
* A useful tool when doing a getConfig.
|
|
* Look into the config {@link FileHelper} for an example of the use.
|
|
* @param s
|
|
* @returns
|
|
*/
|
|
export default function nullIfEmpty<A extends Record<string, any>>(
|
|
s: null | A,
|
|
) {
|
|
if (s === null) return null
|
|
return Object.keys(s).length === 0 ? null : s
|
|
}
|