fitzgen / glob-to-regexp

Convert a glob to a regular expression
152 stars 23 forks source link

Throw Error when glob is not a string #8

Closed roccivic closed 8 years ago

roccivic commented 8 years ago

Output like below is weird, both are edge cases where input is crap though. I think that it makes more sense to throw an Error on invalid input type (like here: https://github.com/sindresorhus/escape-string-regexp/blob/master/index.js#L6)

var g = require('glob-to-regexp');

// Prints: /^\[object Object\]$/
g({});

// Prints: /^NaN$/
g(NaN);