Comparing version 4.0.3 to 5.0.0
@@ -99,2 +99,5 @@ (function() { | ||
contents = fs.readFileSync(objectPath, 'utf8'); | ||
if (contents.trim().length === 0) { | ||
return null; | ||
} | ||
if (csonCache && path.extname(objectPath) === '.cson') { | ||
@@ -114,29 +117,31 @@ cachePath = getCachePath(contents); | ||
var cachePath; | ||
if (contents.trim().length === 0) { | ||
return typeof callback === "function" ? callback(null, null) : void 0; | ||
} | ||
if (error != null) { | ||
return typeof callback === "function" ? callback(error) : void 0; | ||
} | ||
if (csonCache && path.extname(objectPath) === '.cson') { | ||
cachePath = getCachePath(contents); | ||
return fs.stat(cachePath, function(error, stat) { | ||
if (stat != null ? stat.isFile() : void 0) { | ||
return fs.readFile(cachePath, 'utf8', function(error, cached) { | ||
var parsed; | ||
try { | ||
parsed = JSON.parse(cached); | ||
} catch (_error) { | ||
error = _error; | ||
try { | ||
parseContents(objectPath, cachePath, contents, callback); | ||
} catch (_error) {} | ||
return; | ||
} | ||
return typeof callback === "function" ? callback(null, parsed) : void 0; | ||
}); | ||
} else { | ||
return parseContents(objectPath, cachePath, contents, callback); | ||
} | ||
}); | ||
} else { | ||
if (csonCache && path.extname(objectPath) === '.cson') { | ||
cachePath = getCachePath(contents); | ||
return fs.stat(cachePath, function(error, stat) { | ||
if (stat != null ? stat.isFile() : void 0) { | ||
return fs.readFile(cachePath, 'utf8', function(error, cached) { | ||
var parsed; | ||
try { | ||
parsed = JSON.parse(cached); | ||
} catch (_error) { | ||
error = _error; | ||
try { | ||
parseContents(objectPath, cachePath, contents, callback); | ||
} catch (_error) {} | ||
return; | ||
} | ||
return typeof callback === "function" ? callback(null, parsed) : void 0; | ||
}); | ||
} else { | ||
return parseContents(objectPath, cachePath, contents, callback); | ||
} | ||
}); | ||
} else { | ||
return parseContents(objectPath, null, contents, callback); | ||
} | ||
return parseContents(objectPath, null, contents, callback); | ||
} | ||
@@ -143,0 +148,0 @@ }; |
{ | ||
"name": "season", | ||
"version": "4.0.3", | ||
"version": "5.0.0", | ||
"description": "CSON utilities", | ||
@@ -5,0 +5,0 @@ "licenses": [ |
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
13098
11
243