Comparing version 1.8.0 to 1.8.1
@@ -84,31 +84,37 @@ 'use strict'; | ||
value: function load(newPath) { | ||
var file = _fs2.default.readFileSync(newPath, 'utf-8'); | ||
this._path = newPath; | ||
// We use 2 as an empty file with a new line would return 1 | ||
if (file.length >= 2) { | ||
var data = JSON.parse(file); | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
var file = _fs2.default.readFileSync(newPath, 'utf-8'); | ||
this._path = newPath; | ||
// We use 2 as an empty file with a new line would return 1 | ||
if (file.length >= 2) { | ||
var data = JSON.parse(file); | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator2 = Object.keys(data)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var prop = _step2.value; | ||
try { | ||
for (var _iterator2 = Object.keys(data)[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
var prop = _step2.value; | ||
this._config[prop] = data[prop]; | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
this._config[prop] = data[prop]; | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
} | ||
} catch (err) { | ||
if (err.code !== 'ENOENT') { | ||
throw err; | ||
} | ||
} | ||
@@ -115,0 +121,0 @@ } |
{ | ||
"name": "cz", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "A simple config utility for nodejs", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
354518
22