From 1ee6731b51bda063900fe62f8c66d38e6f4b7846 Mon Sep 17 00:00:00 2001 From: David Majda Date: Mon, 16 Apr 2012 16:24:48 +0200 Subject: [PATCH] Supply default option value only if the option is not specified The "|| trick" is too brittle in this case -- it wouldn't work e.g. for options with default value |true| and passed value |false|, enforcing inconsistent default values handling. --- src/emitter.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/emitter.js b/src/emitter.js index cea7981..fc8d884 100644 --- a/src/emitter.js +++ b/src/emitter.js @@ -1,7 +1,9 @@ /* Emits the generated code for the AST. */ PEG.compiler.emitter = function(ast, options) { options = options || {}; - options.trackLineAndColumn = options.trackLineAndColumn || false; + if (options.trackLineAndColumn === undefined) { + options.trackLineAndColumn = false; + } /* * Codie 1.1.0