bare-script 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/data.js +1 -1
- package/lib/library.js +3 -2
- package/package.json +1 -1
package/lib/data.js
CHANGED
|
@@ -74,7 +74,7 @@ const rCSVQuoteEscape = /""/g;
|
|
|
74
74
|
* Determine data field types and parse/validate field values
|
|
75
75
|
*
|
|
76
76
|
* @param {Object[]} data - The data array. Row objects are updated with parsed/validated values.
|
|
77
|
-
* @param {boolean} [csv=false] - If true, parse
|
|
77
|
+
* @param {boolean} [csv=false] - If true, parse value strings
|
|
78
78
|
* @returns {Object} The map of field name to field type ("datetime", "number", "string")
|
|
79
79
|
* @throws Throws an error if data is invalid
|
|
80
80
|
*/
|
package/lib/library.js
CHANGED
|
@@ -415,13 +415,14 @@ function dataTop([data = null, count = null, categoryFields = null]) {
|
|
|
415
415
|
// $group: Data
|
|
416
416
|
// $doc: Validate a data array
|
|
417
417
|
// $arg data: The data array
|
|
418
|
+
// $arg csv: Optional (default is false). If true, parse value strings.
|
|
418
419
|
// $return: The validated data array
|
|
419
|
-
function dataValidate([data = null]) {
|
|
420
|
+
function dataValidate([data = null, csv = false]) {
|
|
420
421
|
if (valueType(data) !== 'array') {
|
|
421
422
|
return null;
|
|
422
423
|
}
|
|
423
424
|
|
|
424
|
-
validateData(data);
|
|
425
|
+
validateData(data, valueBoolean(csv));
|
|
425
426
|
return data;
|
|
426
427
|
}
|
|
427
428
|
|