code: function step1a(token) {    
      if(token.match(/(ss|i)es$/))
          return token.replace(/(ss|i)es$/, '$1');
   
      if(token.substr(-1) == 's' && token.substr(-2, 1) != 's')
          return token.replace(/s?$/, '');
      
      return token;
  }
docs: step 1a as defined for the porter stemmer algorithm.