client/lib/user-settings/index.js
function deleteUnsavedSetting( settings, settingName ) {
	unset( settings, settingName );
	const settingKeys = settingName.split( '.' );
	if ( settingKeys.length > 1 ) {
		settingKeys.pop();
		const parentKey = settingKeys.join( '.' );
		// if parent is empty, call function again
		if ( parentKey && isEmpty( get( settings, parentKey ) ) ) {
			deleteUnsavedSetting( settings, parentKey );
		}
	}
}
function deleteUnsavedSetting( settings, settingName ) {
	unset( settings, settingName );
	const settingKeys = settingName.split( '.' );
	if ( settingKeys.length > 1 ) {
		settingKeys.pop();
		const parentKey = settingKeys.join( '.' );
		// if parent is empty, call function again
		if ( parentKey && isEmpty( get( settings, parentKey ) ) ) {
			deleteUnsavedSetting( settings, parentKey );
		}
	}
}
/*
Deletes a provided unsaved setting, then calls itself recursively
to delete any empty parents of the setting passed to it