bin/build-metadata.js
function deepRemoveUndefinedKeysFromObject( obj ) {
	for ( let key in obj ) {
		if ( obj.hasOwnProperty( key ) ) {
			if ( _.isUndefined( obj[ key ] ) ) {
				delete obj[ key ];
			} else if ( _.isObject( obj[ key ] ) ) {
				deepRemoveUndefinedKeysFromObject( obj[ key ] );
			}
		}
	}
	return obj;
}
function deepRemoveUndefinedKeysFromObject( obj ) {
	for ( let key in obj ) {
		if ( obj.hasOwnProperty( key ) ) {
			if ( _.isUndefined( obj[ key ] ) ) {
				delete obj[ key ];
			} else if ( _.isObject( obj[ key ] ) ) {
				deepRemoveUndefinedKeysFromObject( obj[ key ] );
			}
		}
	}
	return obj;
}
Deeply iterates over the keys of an object to remove any keys that are "undefined". This method modifies the object.
@param {Object} obj
@returns {Object} obj, with keys with value "undefined" removed.