path.join handles null differently on v0.10 #5208

cdnbacon opened this Issue Apr 3, 2013 · 1 comment


None yet

2 participants

cdnbacon commented Apr 3, 2013

Not sure if this is by design, given the string args direction, but according to this comment, it looks like there's a regression in behavior that could be causing subtle bugs if truthiness is used to evaluate inputs.

Namely, this snippet behaves differently under v0.8.21 and v0.10.2

require('path').join(null, 'file.txt');

Under v0.8.21, you get file.txt.

Under v0.10.2, you get

TypeError: Arguments to path.join must be strings
    at path.js:360:15
    at Array.filter (native)
    at Object.exports.join (path.js:358:36)
    at repl:1:17
    at REPLServer.self.eval (repl.js:110:21)
    at repl.js:249:20
    at REPLServer.self.eval (repl.js:122:7)
    at Interface.<anonymous> (repl.js:239:12)
    at Interface.EventEmitter.emit (events.js:95:17)
    at Interface._onLine (readline.js:202:10)
isaacs commented Apr 3, 2013

Truthiness is not the test, stringiness is. Yes, this is by design.

@isaacs isaacs closed this Apr 3, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment