path-parser
path-parser copied to clipboard
test for function with `typeof` not `instanceof`
Allows environments (e.g. jest) to override the global Function constructor
Checking via instanceof resolved to false, which caused the Path#source property to be set incorrectly where partialTest would return {} rather than null when it wasn't meant to match
EDIT: actually, not sure if it is jest which is wrapping Function or the environment I am running my code in (Cloudflare Workers) which doesn't allow eval/new Function
This change would be great, currently preventing this package from use in next.js middleware since it disallows references to Function. This is probably also true for all edge functions