These are chat archives for camperbot/bonfire-friendly-date-ranges

17th
Sep 2015
Jacob Jamell
@jjamell
Sep 17 2015 09:18
function friendly(str) {
  //there is no 0th month, so null for simplicity
  var month = 
    [null,'January','February','March','April',
           'May','June','July','August',
           'September','October','November','December'];
  var day =
    [null,'1st','2nd','3rd','4th','5th','6th','7th',
          '8th','9th','10th','11th','12th','13th','14th',
          '15th','16th','17th','18th','19th','20th','21st',
          '22nd','23rd','24th','25th','26th','27th','28th',
          '29th','30th', '31st'];

  return str.map(format).map(filter).map(convert);

  //utility map functions
  function filter(date,index,str){
    if(index !== 0)
      return date.filter((item,index,self)=>str[0].indexOf(item) !== index && item !== '2015');
    else
      return date.filter((item)=> item !== '2015');
    }

  function format(str){
    str = str.split('-');  //break it up
    str.push(str.shift()); //move year to the end
    return str;            //return array
  }

  function convert(item){
    return item.map(toDateString).join('');
  }

  function toDateString(item,index,str){
    if(str.length === 1)
      return day[+item];

    switch (index){
      case 0: return month[+item];
      case 1: return ' '+day[+item];
      case 2: return ', '+item;
    }
  }
}

friendly(['2015-12-01', '2016-02-03']);
Here's what I have so far, but I'm pretty lost now
Ali-Haider5
@Ali-Haider5
Sep 17 2015 10:08
hint
CamperBot
@camperbot
Sep 17 2015 10:08

hint [1/1]

## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Ali-Haider5
@Ali-Haider5
Sep 17 2015 10:08
hint
CamperBot
@camperbot
Sep 17 2015 10:08
These hints depend on people like you! Please add to this :point_right: Bonfire's Wiki Hints Page
Ali-Haider5
@Ali-Haider5
Sep 17 2015 10:08
hint
CamperBot
@camperbot
Sep 17 2015 10:08

hint [1/1]

## :construction: After this are possible spoiler hints.

Make sure you've tried to hard to solve it yourself before proceeding. :construction:

type hint for next hint :pencil: [Contribute at the FCC Wiki]

Ali-Haider5
@Ali-Haider5
Sep 17 2015 10:08
bonfire palindrome
CamperBot
@camperbot
Sep 17 2015 10:08

:fire:Bonfire: Check for Palindromes :link:

function palindrome(str) {
  // Good luck!
  return true;
}



palindrome("eye");

Return true if the given string is a palindrome. Otherwise, return false.

more info:  bf details | bf links | hint

Ali-Haider5
@Ali-Haider5
Sep 17 2015 10:08
hint
CamperBot
@camperbot
Sep 17 2015 10:08
These hints depend on people like you! Please add to this :point_right: Bonfire's Wiki Hints Page
Jacob Jamell
@jjamell
Sep 17 2015 10:29
I finally did it. It passes every test. I'm done with bonfires forever.