node-datalith 0.0.4 → 0.1.0

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/lib.d.ts CHANGED
@@ -235,3 +235,10 @@ export declare class Datalith {
235
235
  */
236
236
  convertResourceToImage(id: string, options: DeleteOptions & Pick<ImagePutOptions, "maxWidth" | "maxHeight" | "centerCrop">): Promise<Image>;
237
237
  }
238
+ /**
239
+ * Validates if the input string is a valid center crop string (in the format of `"<float>:<float>"`).
240
+ *
241
+ * @param {string}
242
+ * @returns {boolean}
243
+ */
244
+ export declare const validateCenterCrop: (centerCrop?: string) => boolean;
package/lib/lib.js CHANGED
@@ -339,3 +339,15 @@ export class Datalith {
339
339
  }
340
340
  }
341
341
  }
342
+ /**
343
+ * Validates if the input string is a valid center crop string (in the format of `"<float>:<float>"`).
344
+ *
345
+ * @param {string}
346
+ * @returns {boolean}
347
+ */
348
+ export const validateCenterCrop = (centerCrop) => {
349
+ if (typeof centerCrop === "undefined") {
350
+ return true;
351
+ }
352
+ return (/^-?\d+\.?\d*:-?\d+\.?\d*$/).test(centerCrop);
353
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-datalith",
3
- "version": "0.0.4",
3
+ "version": "0.1.0",
4
4
  "description": "Datalith is a file management system powered by SQLite for metadata storage and the file system for file storage. This library can help you conmunicate with Datalith in Node.js.",
5
5
  "type": "module",
6
6
  "exports": "./lib/lib.js",