Initial commit

This commit is contained in:
Spencer Pincott
2024-07-15 22:20:13 -04:00
commit 97737ca1ae
16618 changed files with 934131 additions and 0 deletions

View File

@@ -0,0 +1,81 @@
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// Generated by CoffeeScript 2.3.2
// # Stream Transformer Sync
// Provides a synchronous alternative to the CSV transformer.
// ## Usage
// `const records = transform(data, [options])`
// ## Source Code
var transform;
transform = require('.');
module.exports = function () {
var argument, callback, chunks, data, expected_handler_length, handler, i, j, k, l, len, len1, options, record, transformer, type, v; // Import arguments normalization
options = {};
for (i = j = 0, len = arguments.length; j < len; i = ++j) {
argument = arguments[i];
type = _typeof(argument);
if (argument === null) {
type = 'null';
} else if (type === 'object' && Array.isArray(argument)) {
type = 'array';
}
if (i === 0) {
if (type === 'function') {
handler = argument;
} else if (type !== null) {
data = argument;
}
continue;
}
if (type === 'object') {
for (k in argument) {
v = argument[k];
options[k] = v;
}
} else if (type === 'function') {
if (handler && i === arguments.length - 1) {
callback = argument;
} else {
handler = argument;
}
} else if (type !== 'null') {
throw new Error('Invalid arguments');
}
} // Validate arguments
expected_handler_length = 1;
if (options.params) {
expected_handler_length++;
}
if (handler.length > expected_handler_length) {
throw Error('Invalid Handler: only synchonous handlers are supported');
} // Start transformation
chunks = [];
transformer = new transform.Transformer(options, handler);
transformer.push = function (chunk) {
return chunks.push(chunk);
};
for (l = 0, len1 = data.length; l < len1; l++) {
record = data[l];
transformer._transform(record, null, function () {});
}
return chunks;
};