Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Adding note about empty strings in path module #2106

Closed
wants to merge 2 commits into from

Commits on Jul 7, 2015

  1. doc: Adding note about empty strings in path module

    The path module's `join, normalize, isAbsolute, relative and resolve`
    functions return/use the current directory if they are passed zero
    length strings.
    
        > process.version
        'v2.3.4-pre'
        > path.win32.join('')
        '.'
        > path.posix.join('')
        '.'
        > path.win32.normalize('')
        '.'
        > path.posix.normalize('')
        '.'
        > path.win32.isAbsolute('')
        false
        > path.posix.isAbsolute('')
        false
        > path.win32.relative('', '')
        ''
        > path.posix.relative('', '')
        ''
        > path.win32relative('.', '')
        ''
        > path.posix.relative('.', '')
        ''
        > path.posix.resolve('')
        '/home/thefourtheye/Desktop'
        > path.win32.resolve('')
        '\\home\\thefourtheye\\Desktop'
    
    Since empty paths are not valid in any of the operating systems people
    normally use, this behaviour might be a surprise to the users. This
    commit introduces "Notes" about this, wherever applicable in `path`'s
    documentation.
    thefourtheye committed Jul 7, 2015
    Configuration menu
    Copy the full SHA
    1b6838f View commit details
    Browse the repository at this point in the history
  2. test: zero-length strings with path module functions

    These testcases are specific to one uncommon behaviour in path module.
    Few of the functions in path module, treat '' strings as current working
    directory. This test makes sure that the behaviour is intact between
    commits. See: nodejs#2106
    thefourtheye committed Jul 7, 2015
    Configuration menu
    Copy the full SHA
    a65d5fd View commit details
    Browse the repository at this point in the history