src/components/PlayerSearchBox.js
/**
 * Filter nbaData based on whether the player's full name contains the given
 * string.
 *
 * @param {String} str
 * @param {Object} nbaData - nbaData fetched from sports API
 */
Filter nbaData based on whether the player's full name contains the given
string.

@param {String} str
@param {Object} nbaData - nbaData fetched from sports API
Filter nbaData based on whether the player ' s full name contains the given string . @param { String } str @param { Object } nbaData - nbaData fetched from sports API
function filterNbaDataByPlayerName(str, nbaData) {
  let filteredData = [];
  if (str.length >= 3) {
    filteredData = nbaData.filter(datum => {
      const fullName = datum.player.FirstName + ' ' + datum.player.LastName;
      return (fullName.toLowerCase().indexOf(str.toLowerCase()) !== -1);
    });
  }
  return filteredData;
}
function filterNbaDataByPlayerName ( str , nbaData ) { let filteredData = [ ] ; if ( str . length >= 3 ) { filteredData = nbaData . filter ( datum => { const fullName = datum . player . FirstName + ' ' + datum . player . LastName ; return ( fullName . toLowerCase ( ) . indexOf ( str . toLowerCase ( ) ) !== - 1 ) ; } ) ; } return filteredData ; }
Filter nbaData based on whether the player's full name contains the given
 string.
Filter nbaData based on whether the player ' s full name contains the given string .