Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

resolve - loadPaths argument is not properly handled #36

Open
Faleij opened this issue Dec 31, 2016 · 0 comments
Open

resolve - loadPaths argument is not properly handled #36

Faleij opened this issue Dec 31, 2016 · 0 comments

Comments

@Faleij
Copy link

Faleij commented Dec 31, 2016

fs-plus.coffee

# loadPaths - An {Array} of absolute and relative paths to search.

...

resolve: (args...) ->
    extensions = args.pop() if _.isArray(_.last(args))
    pathToResolve = args.pop()?.toString()
    loadPaths = args

when loadPaths is assigned args, args is an array containing the rest of the parameters - excluding extensions and pathToResolve. args will unexpectedly be a nested array (it should not be) and the resolve method will break because of this. As I have seen implementations using a single string as argument, I propose that loadPaths should be able to be a string or an array;

loadPaths = if _.isArray(_.last(args)) args.pop() else args 

example showing when it breaks: https://runkit.com/58679334ff226c001410a427/586793351fc1d20015993407

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant