"use strict"; var fs = require ("fs"); var path = require ("path"); var parse = require ("./parse"); var INCLUDE_KEY = "include"; var INDEX_FILE = "index.properties"; var cast = function (value){ if (value === null || value === "null") return null; if (value === "undefined") return undefined; if (value === "true") return true; if (value === "false") return false; var v = Number (value); return isNaN (v) ? value : v; }; var expand = function (o, str, options, cb){ if (!options.variables || !str) return cb (null, str); var stack = []; var c; var cp; var key = ""; var section = null; var v; var holder; var t; var n; for (var i=0; i 1 || code < 33 || code > 126){ throw new Error ("The comment token must be a single printable ASCII " + "character"); } c[comment] = true; }); options._comments = c; var separators = options.separators || []; if (!Array.isArray (separators)) separators = [separators]; var s = {}; separators.forEach (function (separator){ code = separator.charCodeAt (0); if (separator.length > 1 || code < 33 || code > 126){ throw new Error ("The separator token must be a single printable ASCII " + "character"); } s[separator] = true; }); options._separators = s; if (options.path){ if (!cb) throw new Error ("A callback must be passed if the 'path' " + "option is enabled"); if (options.include){ read (data, options, cb); }else{ fs.readFile (data, { encoding: "utf8" }, function (error, data){ if (error) return cb (error); build (data, options, ".", cb); }); } }else{ return build (data, options, ".", cb); } };