Skip to content

Handlebars.compile fails on empty string although a single blank works fine #498

Closed
@gotwarlost

Description

@gotwarlost
$ npm install handlebars
$ node
> var Handlebars=require('handlebars');
> Handlebars.compile('foo');
[Function]
> Handlebars.compile(' ');
[Function]
> Handlebars.compile('');
Error: You must pass a string or Handlebars AST to Handlebars.compile. You passed 
    at new Error (unknown source)
    at Error.Handlebars.Exception (/Users/ananthk/tmp/node_modules/handlebars/lib/handlebars/utils.js:8:41)
    at Object.exports.attach.Handlebars.compile (/Users/ananthk/tmp/node_modules/handlebars/lib/handlebars/compiler/compiler.js:1254:11)
    at repl:1:12
    at REPLServer.self.eval (repl.js:109:21)
    at rli.on.self.bufferedCmd (repl.js:258:20)
    at REPLServer.self.eval (repl.js:116:5)
    at Interface.<anonymous> (repl.js:248:12)
    at Interface.EventEmitter.emit (events.js:96:17)
    at Interface._onLine (readline.js:200:10)

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