appwrite-utils
Advanced tools
Comparing version 0.3.3 to 0.3.4
@@ -39,2 +39,7 @@ export interface ConverterFunctions { | ||
/** | ||
* Converts any null, empty, or undefined value to an empty array | ||
* Meant to be used if the value needs to be an array but you can't guarantee it is one | ||
*/ | ||
onlyUnsetToArray(value: any): any[]; | ||
/** | ||
* A function that converts any type of value to an array of numbers. | ||
@@ -41,0 +46,0 @@ * |
@@ -80,2 +80,11 @@ import { DateTime } from "luxon"; | ||
/** | ||
* Converts any null, empty, or undefined value to an empty array | ||
* Meant to be used if the value needs to be an array but you can't guarantee it is one | ||
*/ | ||
onlyUnsetToArray(value) { | ||
if (value === null || value === undefined || value === "") | ||
return []; | ||
return value; | ||
}, | ||
/** | ||
* A function that converts any type of value to an array of numbers. | ||
@@ -82,0 +91,0 @@ * |
{ | ||
"name": "appwrite-utils", | ||
"module": "dist/index.js", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"main": "dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "dist/index.d.ts", |
@@ -75,2 +75,3 @@ # appwrite-utils | ||
- 0.3.4: Added `onlyUnsetToArray` converter, which is meant to be used last so if you need to guarantee something is an array instead of null or undefined, you would use that | ||
- 0.2.8: Added `valueToSet` to attributeMappings, allowing you to set the thing you want to set literally in importDefs | ||
@@ -77,0 +78,0 @@ - 0.2.7: Removed need for `lodash` |
@@ -82,2 +82,11 @@ import { DateTime } from "luxon"; | ||
/** | ||
* Converts any null, empty, or undefined value to an empty array | ||
* Meant to be used if the value needs to be an array but you can't guarantee it is one | ||
*/ | ||
onlyUnsetToArray(value: any): any[] { | ||
if (value === null || value === undefined || value === "") return []; | ||
return value; | ||
}, | ||
/** | ||
* A function that converts any type of value to an array of numbers. | ||
@@ -84,0 +93,0 @@ * |
347602
9049
87