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

resolve - loadPaths argument is not properly handled #36

@Faleij

Description

@Faleij

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions