code: function createPatternVariations(pattern) {
      var lastCharIdx = pattern.length - 1,
          patternVariations = [pattern, '!' + pattern];
  
      if (pattern[lastCharIdx] === '/') {
          var unslashed = pattern.substring(0, lastCharIdx);
  
          patternVariations.push(unslashed);
          patternVariations.push('!' + unslashed);
      }
  
      return patternVariations;
  }
docs: Produce pattern variations for filtering.
  We skip patterns if they are already in .npmignore files or
  if they are restricted to be ignored (with leading '!').
  Also, we test for pattern without trailing '/'