lib/get-fields.js
function getFieldsFromTweetLike(tweetLike) {
  var fields = fieldsToCheck.map(function(fieldName) {
    return _.get(tweetLike, fieldName);
  });

  arrayFieldsToCheck.forEach(function(fieldDescription) {
    var arr = _.get(tweetLike, fieldDescription.arrayAt);
    if (_.isArray(arr)) {
      arr.forEach(function(element) {
        fields.push(_.get(element, fieldDescription.inEach));
      });
    }
  });

  return fields.filter(function(field) {
    return typeof field === 'string' && field.trim().length !== 0;
  }).map(function(field) {
    return field.toLowerCase();
  });
}
function getFieldsFromTweetLike(tweetLike) {
  var fields = fieldsToCheck.map(function(fieldName) {
    return _.get(tweetLike, fieldName);
  });

  arrayFieldsToCheck.forEach(function(fieldDescription) {
    var arr = _.get(tweetLike, fieldDescription.arrayAt);
    if (_.isArray(arr)) {
      arr.forEach(function(element) {
        fields.push(_.get(element, fieldDescription.inEach));
      });
    }
  });

  return fields.filter(function(field) {
    return typeof field === 'string' && field.trim().length !== 0;
  }).map(function(field) {
    return field.toLowerCase();
  });
}
function getFieldsFromTweetLike ( tweetLike ) { var fields = fieldsToCheck . map ( function ( fieldName ) { return _ . get ( tweetLike , fieldName ) ; } ) ; arrayFieldsToCheck . forEach ( function ( fieldDescription ) { var arr = _ . get ( tweetLike , fieldDescription . arrayAt ) ; if ( _ . isArray ( arr ) ) { arr . forEach ( function ( element ) { fields . push ( _ . get ( element , fieldDescription . inEach ) ) ; } ) ; } } ) ; return fields . filter ( function ( field ) { return typeof field === 'string' && field . trim ( ) . length !== 0 ; } ) . map ( function ( field ) { return field . toLowerCase ( ) ; } ) ; }
Takes a tweet or a subobject of tweet and looks for strings in the positions listed in fieldsToCheck and arrayFieldsToCheck
Takes a tweet or a subobject of tweet and looks for strings in the positions listed in fieldsToCheck and arrayFieldsToCheck