better-ajv-errors
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -16,5 +16,5 @@ 'use strict'; | ||
var _dataPath$split$slice = dataPath.split('/').slice(1).reduce(function (obj, pointer) { | ||
return obj.value[pointer] || obj.value.value[pointer]; | ||
return obj[_parse.VALUE_SYMBOL][pointer] || obj[_parse.VALUE_SYMBOL][_parse.VALUE_SYMBOL][pointer]; | ||
}, (0, _parse2.default)(jsonString)), | ||
_dataPath$split$slice2 = _dataPath$split$slice.meta, | ||
_dataPath$split$slice2 = _dataPath$split$slice[_parse.META_SYMBOL], | ||
line = _dataPath$split$slice2.line, | ||
@@ -21,0 +21,0 @@ column = _dataPath$split$slice2.column; |
'use strict'; | ||
exports.__esModule = true; | ||
exports.VALUE_SYMBOL = exports.META_SYMBOL = undefined; | ||
var _symbol = require('babel-runtime/core-js/symbol'); | ||
var _symbol2 = _interopRequireDefault(_symbol); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// Custom JSON parser based on https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js | ||
@@ -10,2 +18,5 @@ var line = void 0; | ||
var META_SYMBOL = exports.META_SYMBOL = (0, _symbol2.default)('meta'); | ||
var VALUE_SYMBOL = exports.VALUE_SYMBOL = (0, _symbol2.default)('value'); | ||
var escapee = { | ||
@@ -203,4 +214,4 @@ '"': '"', | ||
var obj = {}; | ||
obj.meta = { line, column }; | ||
obj.value = {}; | ||
obj[META_SYMBOL] = { line, column }; | ||
obj[VALUE_SYMBOL] = {}; | ||
@@ -222,5 +233,5 @@ if (ch === '{') { | ||
} | ||
obj.value[key] = {}; | ||
obj.value[key].meta = { line, column: c }; | ||
obj.value[key].value = value(); | ||
obj[VALUE_SYMBOL][key] = {}; | ||
obj[VALUE_SYMBOL][key][META_SYMBOL] = { line, column: c }; | ||
obj[VALUE_SYMBOL][key][VALUE_SYMBOL] = value(); | ||
white(); | ||
@@ -274,4 +285,2 @@ if (ch === '}') { | ||
return result; | ||
}; | ||
module.exports = exports['default']; | ||
}; |
@@ -15,3 +15,3 @@ 'use strict'; | ||
// TODO: Handle json pointer escape notation and better error handling | ||
const { meta: { line, column } } = dataPath.split('/').slice(1).reduce((obj, pointer) => obj.value[pointer] || obj.value.value[pointer], (0, _parse2.default)(jsonString)); | ||
const { [_parse.META_SYMBOL]: { line, column } } = dataPath.split('/').slice(1).reduce((obj, pointer) => obj[_parse.VALUE_SYMBOL][pointer] || obj[_parse.VALUE_SYMBOL][_parse.VALUE_SYMBOL][pointer], (0, _parse2.default)(jsonString)); | ||
@@ -18,0 +18,0 @@ return { line, column }; |
@@ -10,2 +10,5 @@ 'use strict'; | ||
const META_SYMBOL = exports.META_SYMBOL = Symbol('meta'); | ||
const VALUE_SYMBOL = exports.VALUE_SYMBOL = Symbol('value'); | ||
const escapee = { | ||
@@ -203,4 +206,4 @@ '"': '"', | ||
const obj = {}; | ||
obj.meta = { line, column }; | ||
obj.value = {}; | ||
obj[META_SYMBOL] = { line, column }; | ||
obj[VALUE_SYMBOL] = {}; | ||
@@ -222,5 +225,5 @@ if (ch === '{') { | ||
} | ||
obj.value[key] = {}; | ||
obj.value[key].meta = { line, column: c }; | ||
obj.value[key].value = value(); | ||
obj[VALUE_SYMBOL][key] = {}; | ||
obj[VALUE_SYMBOL][key][META_SYMBOL] = { line, column: c }; | ||
obj[VALUE_SYMBOL][key][VALUE_SYMBOL] = value(); | ||
white(); | ||
@@ -274,4 +277,2 @@ if (ch === '}') { | ||
return result; | ||
}; | ||
module.exports = exports['default']; | ||
}; |
{ | ||
"name": "better-ajv-errors", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "JSON Schema validation for Human", | ||
@@ -5,0 +5,0 @@ "repository": "torifat/better-ajv-errors", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a 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
59329
1533
1