code: function collect(obj, field) {
        // utility function to get nested property
        function dig(obj, selector) {
          var result = obj;
          var splitter = selector.split('.');
  
          for (var i = 0; i < splitter.length; i++) {
            if (typeof result === 'undefined' || result === null) {
              return undefined;
            }
  
            result = result[splitter[i]];
          }
  
          return result;
        }
  
        if (typeof field === 'function') return field(obj);
        if (typeof field === 'string') return dig(obj, field);
        return undefined;
      }
docs: field can be: 1. function 2. regular property - ex: 'prop' 3. nested property path - ex: 'nested.prop'