tidepool-org/blip — pull request #53 by nicolashery (2014-04-17 13:42:05+00:00)
Title: Fix check for empty data

This fixes the check for a user not having any data stream (yet), to allow the display of a "no data yet" message. The check didn't work anymore with newer versions of Tideline (we switch from an array to a `TidelineData` object for the data set), so we would pass empty data sets to Tideline which would crash the render.

I also took the opportunity to create a little `getIn(obj, props, notFound)` helper function, which I'm putting in `app/core/utils.js` for now (will continue putting generic stuff like this there, so we can easily pull out as independent library later if need be).

I'm often checking for the presence of nested properties in objects, so now instead of doing something like:

```javascript
var size = (patientData && patientData.data && patientData.data.length) || 0;
```

I can do:

```javascript
var size = utils.getIn(patientData, ['data', 'length'], 0);
```

Nothing ground-breaking here, but a little cleaner I think :)