|
|
|
@ -85,19 +85,19 @@ var handleCommand = function (meta, line) {
|
|
|
|
|
|
|
|
|
|
Meta.createLineHandler = function (ref, errorHandler) {
|
|
|
|
|
ref.meta = {};
|
|
|
|
|
ref.index = 0;
|
|
|
|
|
|
|
|
|
|
var index = 0;
|
|
|
|
|
return function (err, line) {
|
|
|
|
|
if (err) {
|
|
|
|
|
return void errorHandler('METADATA_HANDLER_LINE_ERR', {
|
|
|
|
|
error: err,
|
|
|
|
|
index: index,
|
|
|
|
|
index: ref.index,
|
|
|
|
|
line: JSON.stringify(line),
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Array.isArray(line)) {
|
|
|
|
|
index++;
|
|
|
|
|
ref.index++;
|
|
|
|
|
try {
|
|
|
|
|
handleCommand(ref.meta, line);
|
|
|
|
|
} catch (err2) {
|
|
|
|
@ -109,8 +109,8 @@ Meta.createLineHandler = function (ref, errorHandler) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (index === 0 && typeof(line) === 'object') {
|
|
|
|
|
index++;
|
|
|
|
|
if (ref.index === 0 && typeof(line) === 'object') {
|
|
|
|
|
ref.index++;
|
|
|
|
|
// special case!
|
|
|
|
|
ref.meta = line;
|
|
|
|
|
return;
|
|
|
|
@ -118,7 +118,7 @@ Meta.createLineHandler = function (ref, errorHandler) {
|
|
|
|
|
|
|
|
|
|
errorHandler("METADATA_HANDLER_WEIRDLINE", {
|
|
|
|
|
line: line,
|
|
|
|
|
index: index++,
|
|
|
|
|
index: ref.index++,
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|