Skip to content

Instantly share code, notes, and snippets.

View hughgrigg's full-sized avatar

Hugh Grigg hughgrigg

View GitHub Profile
@hughgrigg
hughgrigg / json-utils.ts
Created November 19, 2019 15:37
TypeScript JSON utils
import * as _ from 'lodash'
import * as objectPath from 'object-path'
import * as stringify from 'json-stringify-safe'
/**
* Recursively replace undefined with null.
*/
export function undefinedToNull<T>(obj: T): T {
if (obj === undefined) {
return null