@marteye/studio-cli
Version:
CLI for MartEye Studio API
38 lines (34 loc) • 897 B
JavaScript
;
var index = require('./api/index.js');
var normalize_options = require('./api/normalize_options.js');
const stringify = function (records, opts = {}) {
const data = [];
const [err, options] = normalize_options.normalize_options(opts);
if (err !== undefined) throw err;
const state = {
stop: false,
};
// Information
const info = {
records: 0,
};
const api = index.stringifier(options, state, info);
for (const record of records) {
const err = api.__transform(record, function (record) {
data.push(record);
});
if (err !== undefined) throw err;
}
if (data.length === 0) {
api.bom((d) => {
data.push(d);
});
const err = api.headers((headers) => {
data.push(headers);
});
if (err !== undefined) throw err;
}
return data.join("");
};
exports.stringify = stringify;
//# sourceMappingURL=sync.js.map