Skip to content

Instantly share code, notes, and snippets.

@choonkending
Last active June 1, 2017 11:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save choonkending/050de8a5fd3bf349120db80e4f714cb7 to your computer and use it in GitHub Desktop.
Save choonkending/050de8a5fd3bf349120db80e4f714cb7 to your computer and use it in GitHub Desktop.
const getFeatures = data => {
if (data && data.listing && data.listing.features) {
const { bedrooms, bathrooms } = data.listing.features;
const beds = bedrooms && bedrooms.value || 0;
const baths = bathrooms && bathrooms.value || 0;
if (beds === 0 && baths === 0) return null;
return {
bedrooms: beds,
bathrooms: baths
};
}
return null;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment