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AAO,KAAK,MAAM,GAAG,OAAO,KAAK,OAAQ,KAAK,KAAM,CAAC,GACzD,CAMA,KAAA,CAAM,GACF,OAAO,GAAG,MAAM,KAAK,OAAQ,KAAK,KAAM,EAC5C,CAKA,MAAA,GACI,OAAO,GAAG,OAAO,KAAK,OAAQ,KAAK,KACvC,CAKA,KAAA,GACI,OAAO,GAAG,MAAM,KAAK,OAAQ,KAAK,KACtC,CAQA,YAAM,CAAO,EAAU,EAAM,SACnB,GAAG,OAAO,KAAM,EAAU,EAAM,EAC1C,EAGJ,QAAQ,QAAU","file":"/npm/node-dataset@1.4.7/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/node-dataset@1.4.7/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const methods = require(\"./lib/methods\");\nconst io = require(\"./lib/io\");\n\n/**\n * The DataSet class\n * @class DataSet\n */\n\nclass DataSet {\n\n    /**\n     * Construct a new DataSet\n     * @constructs DataSet\n     * @param {string} name - name of the DataSet\n     * @param {string|object} fields - comma separated list, or array, of fields in the DataSet\n     * @param {array} data - array of arrays comprising the data of the DataSet\n     */\n    constructor(name, fields, data) {\n        this.name = (name && typeof(name) === \"string\" && name.length > 0) ? name : null;\n        this.fields = (fields && fields.length > 0)\n            ? (typeof fields === \"string\")\n                ? fields.split(/\\s*,\\s*/)\n                : fields\n            : [];\n        this.data = (data && Array.isArray(data)) ? data : [];\n    }\n\n    /**\n     * Get the name of the DataSet\n     */\n    getName() {\n        return this.name;\n    }\n\n    /**\n     * Set the name of the DataSet\n     * @param {string} name - name of the DataSet\n     */\n    setName(name) {\n        this.name = (name && typeof(name) === \"string\" && name.length > 0) ? name : null;\n        return this;\n    }\n\n    /**\n     * Get the fields of the DataSet\n     */\n    getFields() {\n        return this.fields;\n    }\n\n    /**\n     * Set the fields of the DataSet\n     * @param {string|object} fields - comma separated list, or array, of fields in the DataSet\n     */\n    setFields(fields) {\n        const newFields = (fields && fields.length > 0)\n            ? (typeof fields === \"string\")\n                ? fields.split(/\\s*,\\s*/)\n                : fields\n            : [];\n        if (this.fields.length === newFields.length) this.fields = newFields;\n        return this;\n    }\n\n    /**\n     * Get the data of the DataSet\n     */\n    getData() {\n        return this.data;\n    }\n\n    /**\n     * Set the data of the DataSet\n     * @param {object} data - array of arrays comprising the data of the DataSet\n     */\n    setData(data) {\n        if (data && Array.isArray(data)) {\n            if (data.length === 0 || data[0].length === this.fields.length) this.data = data;\n        }\n        return this;\n    }\n\n    /**\n     * Get the number of records in the DataSet\n     */\n    count() {\n        return this.data.length;\n    }\n\n    /**\n     * Select the data for a set of fields from the DataSet\n     * @param {string} fieldList - comma separated list of fields to return\n     */\n    select(fieldList) {\n        return new DataSet().fromArray(methods.select(this, fieldList));\n    }\n\n    /**\n     * Join the DataSet with another DataSet\n     * @param {Object} dataset - the DataSet to join this DataSet with\n     * @param {string} type - the type of join to construct (cross, inner, left, or right)\n     * @param {string} fieldList1 - comma separated list of fields from this DataSet to use to for the join\n     * @param {string} fieldList2 - comma separated list of fields from the joined to DataSet to use for the join\n     */\n    join(dataset, type, fieldList1, fieldList2) {\n        return new DataSet().fromArray(methods.join(this, dataset, type, fieldList1, fieldList2));\n    }\n\n    /**\n     * Filter the DataSet for a subset of data\n     * @param {string} filterStatement - statement describing the filter to be applied\n     * @param {boolean} useEval - whether to use the new Function constructor (similar to eval) to evaluate against filterStatement\n     */\n    filter(filterStatement, useEval) {\n        return new DataSet().fromArray(methods.filter(this, filterStatement, useEval));\n    }\n    \n    /**\n     * Filter the DataSet for a subset of data\n     * @param {string} filterStatement - statement describing the filter to be applied\n     * @param {boolean} useEval - whether to use the new Function constructor (similar to eval) to evaluate against filterStatement\n     */\n    where(filterStatement, useEval) {\n        return this.filter(filterStatement, useEval);\n    }\n\n    /**\n     * Sort the data in the DataSet\n     * @param {string} sortStatement - statement describing how to sort the DataSet\n     */\n    sort(sortStatement) {\n        return new DataSet().fromArray(methods.sort(this, sortStatement));\n    }\n\n    /**\n     * Sort the data in the DataSet\n     * @param {string} sortStatement - statement describing how to sort the DataSet\n     */\n    orderby(sortStatement) {\n        return this.sort(sortStatement);\n    }\n\n    /**\n     * Perform aggregate functions on fields in the DataSet\n     * @param {string} aggregationList - comma separated list of aggregate functions to perform\n     * @param {string} groupList - comma separated list of fields to group by\n     */\n    aggregate(aggregationList, groupList) {\n        return new DataSet().fromArray(methods.aggregate(this, aggregationList, groupList));\n    }\n\n    /**\n     * Retrieve a slice of the data in the DataSet (using zero-based array indexing)\n     * @param {number} begin - the array index indicating where the slice should begin\n     * @param {number} end - the array index indicating where the slice should end (not included in the results)\n     */\n    slice(begin, end) {\n        return new DataSet().fromArray(methods.slice(this, begin, end));\n    }\n\n    /**\n     * Retrieve a slice of the data in the DataSet starting with the first element\n     * @param {number} number - the number of elements to return\n     */\n    limit(number) {\n        return this.slice(0, number);\n    }\n\n    /**\n     * Populate the DataSet from an array\n     * @param {array} array - an array containing the name, fields and data for the DataSet\n     */\n    fromArray(array) {\n        this.name = array[0];\n        this.fields = array[1];\n        this.data = array[2];\n        return this;\n    }\n\n    /**\n     * Populate the DataSet from an array of JSON objects\n     * @param {array} json - an array of JSON objects where the keys are the fields and the values are the data\n     */\n    fromJSON(json) {\n        this.fromArray([this.name].concat(io.fromJSON(json)));\n        return this;\n    }\n\n    /**\n     * Populate the DataSet from a CSV-formatted string\n     * @param {string} csv - a CSV-formatted string where the first line contains the fields and the rest are the data\n     * @param {object} options - options for the file (header, delimiter and quote)\n     */\n    fromCSV(csv, options) {\n        this.fromArray([this.name].concat(io.fromCSV(csv, options)));\n        return this;\n    }\n\n    /**\n     * Populate the DataSet from an Excel file buffer\n     * @param {object} xlsx - an Excel file buffer\n     * @param {object} options - options for the file (header, worksheet, range)\n     */\n    fromXLSX(xlsx, options) {\n        this.fromArray([this.name].concat(io.fromXLSX(xlsx, options)));\n        return this;\n    }\n\n    /**\n     * Populate the DataSet from an HTML table\n     * @param {string} csv - a HTML table\n     * @param {object} options - options for the table (header)\n     */\n    fromHTML(html, options) {\n        this.fromArray([this.name].concat(io.fromHTML(html, options)));\n        return this;\n    }\n\n    /**\n     * Populate the DataSet using data in a file\n     * @param {string} filePath - the path to the file containing the data from which to construct the DataSet\n     * @param {string} type - the type of file/format of the data (json or csv)\n     * @param {object} options - options for the file (delimiter and quote character for csv)\n     */\n    async fromFile(filePath, type, options) {\n        this.fromArray(await io.fromFile(filePath, type, options));\n        return this;\n    }\n\n    /**\n     * Populate the DataSet using MySQL query results\n     * @param {Object} options - options for the MySQL connection\n     * @param {string} query - query to retrieve the data for the DataSet\n     */\n    async fromMySQL(options, query) {\n        this.fromArray([this.name].concat(await io.fromMySQL(options, query)));\n        return this;\n    }\n\n    /**\n     * Populate the DataSet using MongoDB query results\n     * @param {string} url - url of the database\n     * @param {string} database - name of the database\n     * @param {string} collection - name of the connection\n     * @param {object} query - the query to execute to retrieve results\n     * @param {object} project - the projection to execute on the results\n     */\n    async fromMongoDB(url, database, collection, query, projection) {\n        this.fromArray([this.name].concat(await io.fromMongoDB(url, database, collection, query, projection)));\n        return this;\n    }\n\n    /**\n     * Convert the DataSet to JSON format\n     */\n    toJSON() {\n        return JSON.parse(io.toJSON(this.fields, this.data, {}));\n    }\n\n    /**\n     * Convert the DataSet to CSV format\n     * @param {object} options - options for the file (header, delimiter and quote)\n     */\n    toCSV(options) {\n        return io.toCSV(this.fields, this.data, options);\n    }\n\n    /**\n     * Convert the DataSet to HTML format\n     */\n    toHTML() {\n        return io.toHTML(this.fields, this.data);\n    }\n\n    /**\n     * Convert the DataSet to XML format\n     */\n    toXML() {\n        return io.toXML(this.fields, this.data);\n    }\n\n    /**\n     * Write the DataSet to a file\n     * @param {string} filePath - the path to the output file\n     * @param {string} type - the type of file/format of the data (json or csv)\n     * @param {object} options - options for the file (csv: header, delimiter and quote; json: pretty and space)\n     */\n    async toFile(filePath, type, options) {\n        await io.toFile(this, filePath, type, options);\n    }\n}\n\nexports.DataSet = DataSet;\n"]}