index.js 359 B

123456789101112131415
  1. 'use strict';
  2. module.exports = function(pattern) {
  3. if (typeof pattern !== 'string') {
  4. throw new TypeError('expected a string');
  5. }
  6. var glob = { negated: false, pattern: pattern, original: pattern };
  7. if (pattern.charAt(0) === '!' && pattern.charAt(1) !== '(') {
  8. glob.negated = true;
  9. glob.pattern = pattern.slice(1);
  10. }
  11. return glob;
  12. };