shared-store
Advanced tools
Comparing version 1.0.12 to 1.1.0
@@ -0,1 +1,6 @@ | ||
1.1.0 | ||
----- | ||
* More useful parse errors for files - @jkrems | ||
https://github.com/groupon/shared-store/pull/24 | ||
1.0.12 | ||
@@ -2,0 +7,0 @@ ------ |
@@ -35,3 +35,3 @@ // Generated by CoffeeScript 1.9.0 | ||
'use strict'; | ||
var CSON, Promise, debug, dirChanges, fileChanges, fileContent, fromPromiseFunction, fs, identity, isMissingError, onInterval, parserFromExtension, partial, path, promisify, readFile, _ref; | ||
var CSON, Promise, debug, dirChanges, fileChanges, fileContent, fromPromiseFunction, fs, identity, isMissingError, onInterval, parseCSON, parseJSON, parserFromExtension, partial, path, promisify, readFile, _ref; | ||
@@ -70,8 +70,30 @@ fs = require('fs'); | ||
parseCSON = function(filename, content) { | ||
var err; | ||
try { | ||
return CSON.parse(content); | ||
} catch (_error) { | ||
err = _error; | ||
err.message += " in " + filename + ":" + (err.location.first_line + 1); | ||
throw err; | ||
} | ||
}; | ||
parseJSON = function(filename, content) { | ||
var err; | ||
try { | ||
return JSON.parse(content); | ||
} catch (_error) { | ||
err = _error; | ||
err.message += " in " + filename; | ||
throw err; | ||
} | ||
}; | ||
parserFromExtension = function(filename) { | ||
switch (path.extname(filename)) { | ||
case '.json': | ||
return JSON.parse; | ||
return partial(parseJSON, filename); | ||
case '.cson': | ||
return CSON.parse; | ||
return partial(parseCSON, filename); | ||
default: | ||
@@ -78,0 +100,0 @@ return identity; |
{ | ||
"name": "shared-store", | ||
"version": "1.0.12", | ||
"version": "1.1.0", | ||
"description": "Keeping config data in sync", | ||
@@ -5,0 +5,0 @@ "main": "lib/shared-store.js", |
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
101925
1130
43