properties
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -11,2 +11,2 @@ "use strict"; | ||
return error; | ||
} | ||
}; |
@@ -12,9 +12,8 @@ "use strict"; | ||
var convertType = function (value, cb){ | ||
if (value === null) return cb (null, null); | ||
if (value === "null") return cb (null, null); | ||
if (value === null || value === "null") return cb (null, null); | ||
if (value === "undefined") return cb (null, undefined); | ||
if (value === "true") return cb (null, true); | ||
if (value === "false") return cb (null, false); | ||
var v = Number (value); | ||
if (isNaN (v)) return cb (null, value); | ||
cb (null, v); | ||
return cb (null, isNaN (v) ? value : v); | ||
}; | ||
@@ -153,3 +152,3 @@ | ||
var build = function (data, options, cb){ | ||
var build = function (data, options, dirname, cb){ | ||
var o = {}; | ||
@@ -175,3 +174,3 @@ | ||
var p = path.resolve (value); | ||
var p = path.resolve (dirname, value); | ||
if (options._included[p]) return; | ||
@@ -379,11 +378,13 @@ | ||
var read = function (f, options, cb, first){ | ||
var read = function (f, options, cb){ | ||
fs.stat (f, function (error, stats){ | ||
if (error) return cb (error); | ||
var dirname; | ||
if (stats.isDirectory ()){ | ||
if (first) options._dirname = f; | ||
dirname = f; | ||
f = path.join (f, INDEX_FILE); | ||
}else if (first){ | ||
options._dirname = path.dirname (f); | ||
}else{ | ||
dirname = path.dirname (f); | ||
} | ||
@@ -393,3 +394,3 @@ | ||
if (error) return cb (error); | ||
build (data, options, cb); | ||
build (data, options, dirname, cb); | ||
}); | ||
@@ -409,4 +410,2 @@ }); | ||
options._included = {}; | ||
//If there's no path the basedir is the cwd | ||
options._dirname = "."; | ||
} | ||
@@ -448,3 +447,3 @@ | ||
if (options.include){ | ||
read (data, options, cb, true); | ||
read (data, options, cb); | ||
}else{ | ||
@@ -457,4 +456,4 @@ fs.readFile (data, { encoding: "utf8" }, function (error, data){ | ||
}else{ | ||
return build (data, options, cb); | ||
return build (data, options, ".", cb); | ||
} | ||
}; |
{ | ||
"name": "properties", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": ".properties parser/stringifier", | ||
"keywords": ["properties", "ini", "parser", "stringifier", "config"], | ||
"author": { | ||
"name": "Gabriel Llamas", | ||
"email": "gagle@outlook.com" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/gagle/node-properties.git" | ||
}, | ||
"author": "Gabriel Llamas <gagle@outlook.com>", | ||
"repository": "git://github.com/gagle/node-properties.git", | ||
"engines": { | ||
@@ -19,3 +13,4 @@ "node": ">=0.10" | ||
"ini": "*", | ||
"speedy": "*" | ||
"speedy": "*", | ||
"js-yaml": "*" | ||
}, | ||
@@ -22,0 +17,0 @@ "license": "MIT", |
@@ -8,3 +8,3 @@ properties | ||
Version: 1.0.2 | ||
Version: 1.0.3 | ||
@@ -175,3 +175,3 @@ [Specification](http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load%28java.io.Reader%29) | ||
When the `namespaces` option is enabled dot separated keys are parsed as namespaces, that is, they are interpreted as javascript objects. | ||
When the `namespaces` option is enabled dot separated keys are parsed as namespaces, that is, they are interpreted as JavaScript objects. | ||
@@ -184,3 +184,3 @@ ``` | ||
These properties creates the following object: | ||
These properties create the following object: | ||
@@ -267,7 +267,7 @@ ```javascript | ||
When the `include` option is enabled, the `include` key allows you import files. If the path is a directory it tries to load the file `index.properties`. The paths are relative from the main file, the path that you pass to the [parse()](#parse) function. | ||
When the `include` option is enabled, the `include` key allows you import files. If the path is a directory it tries to load the file `index.properties`. The paths are relative from the __current__ file. | ||
The imported files are merged with the current file, they can replace old data. | ||
The _include_ keywords cannot appear inside a section, they must be global properties. | ||
The _include_ keyword cannot appear inside a section, it must be a global property. | ||
@@ -274,0 +274,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45179
3
892
3