code: function filterPaths(paths, allowed) {
    if (!allowed) { return []; }
    if (!allowed.only.length) { return paths; }
  
    return paths.filter(
      path => {
        let match = false;
  
        for (const filter of allowed.only) {
          try {
            switch (typeof filter) {
              case 'function':
                match = filter(path.path);
                break;
              case 'string':
                match = path.path === filter;
                break;
              default:
                match = filter.test(path.path);
           }
          } catch (e) {
            throw new Error(`${ typeof filter } is not an allowed filter type. Must be String, RegExp or Function`);
          }
          if (match) { return match; }
        }
        return match;
      }
    );
  }
docs: Filter paths based on allowed paths, which can be: string, callback or a regex