Closed charlierudolph closed 9 years ago
@substack any thoughts?
@substack bump. I'm fine if you don't want to support this, just looking for some feedback
Hey @charlierudolph, a few things:
opts.isRequire
? Especially since the return object's strings
doesn't contain any info about where the string came from.opts.properties
, why not optimize for it by changing else if (callee.type === 'MemberExpression' &&
to else if (properties && callee.type === 'MemberExpression' &&
? (That also means changing var properties = opts.properties
).require[resolve]('b');
Couldn't you do this by passing in a custom opts.isRequire? Especially since the return object's strings doesn't contain any info about where the string came from.
Yeah that's how I currently support this. Just wanted to move some of that logic in here as I felt require.resolve is a pretty normal thing to do
Since the most common use case is to not pass opts.properties, why not optimize for it by changing else if (callee.type === 'MemberExpression' && to else if (properties && callee.type === 'MemberExpression' &&? (That also means changing var properties = opts.properties).
ok
Your test would also pass if you did requireresolve;
I'm fine with that, are you suggesting adding a test case for that?
For substack PRs, he likes the extra spaces.
So he wants the trailing whitespace? My editor removes that automatically but I can try to put it back
Yeah that's how I currently support this. Just wanted to move some of that logic in here as I felt require.resolve is a pretty normal thing to do
That's the point of providing a configurable test function, to keep thing custom checks out of the core project :smile: So if it's already working for you, then it makes sense to keep it out.
A simpler interface for having support for both
require
andrequire.resolve
instead of having to implement my ownisRequire
function.