appwrite-utils
Advanced tools
Comparing version 0.9.97 to 0.9.98
@@ -24,5 +24,14 @@ import { ID, InputFile, Query, } from "node-appwrite"; | ||
return mapping.converters.reduce((value, converterName) => { | ||
let shouldProcessAsArray = false; | ||
if ((converterName.includes("[Arr]") || | ||
converterName.includes("[arr]")) && | ||
Array.isArray(value)) { | ||
shouldProcessAsArray = true; | ||
converterName = converterName | ||
.replace("[Arr]", "") | ||
.replace("[arr]", ""); | ||
} | ||
const converterFunction = converterFunctions[converterName]; | ||
if (converterFunction) { | ||
if (Array.isArray(value)) { | ||
if (Array.isArray(value) && !shouldProcessAsArray) { | ||
return value.map((item) => converterFunction(item)); | ||
@@ -29,0 +38,0 @@ } |
{ | ||
"name": "appwrite-utils", | ||
"version": "0.9.97", | ||
"version": "0.9.98", | ||
"description": "Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more.", | ||
@@ -5,0 +5,0 @@ "bin": { |
@@ -112,3 +112,3 @@ # AppwriteUtils Package | ||
Converters take a value (in the import data) and convert it, before validating it or processing it | ||
If the input is an array, the converter will be run on each value | ||
If the converter name has `[arr]` or `[Arr]` anywhere in it, the converter will be run on the array as a whole (assuming it is one), otherwise if it's an array it will run the converter on each item in the array (or string lol) | ||
@@ -115,0 +115,0 @@ - `anyToString(value: any): string | null` |
651814
16177