@timardex/cluemart-shared 1.2.97 → 1.2.99

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/dist/index.d.mts CHANGED
@@ -1893,11 +1893,6 @@ declare const isFutureDatesBeforeThreshold: (date: {
1893
1893
  }, minHoursFromNow: number) => boolean;
1894
1894
  declare const formatTimestamp: (timestamp: string) => string;
1895
1895
  declare const defaultRegion: Region;
1896
- /**
1897
- * Function to remove __typename from an object or array of objects.
1898
- * @param obj - The object or array to clean.
1899
- * @returns - The cleaned object or array.
1900
- */
1901
1896
  declare const removeTypename: (obj: any) => any;
1902
1897
  /**
1903
1898
  * Truncate text to a specified length and append ellipsis if necessary.
package/dist/index.d.ts CHANGED
@@ -1893,11 +1893,6 @@ declare const isFutureDatesBeforeThreshold: (date: {
1893
1893
  }, minHoursFromNow: number) => boolean;
1894
1894
  declare const formatTimestamp: (timestamp: string) => string;
1895
1895
  declare const defaultRegion: Region;
1896
- /**
1897
- * Function to remove __typename from an object or array of objects.
1898
- * @param obj - The object or array to clean.
1899
- * @returns - The cleaned object or array.
1900
- */
1901
1896
  declare const removeTypename: (obj: any) => any;
1902
1897
  /**
1903
1898
  * Truncate text to a specified length and append ellipsis if necessary.
package/dist/index.mjs CHANGED
@@ -415,18 +415,25 @@ var defaultRegion = {
415
415
  longitude: 174.7450494,
416
416
  longitudeDelta: 5
417
417
  };
418
+ var isIsoDateString = (value) => {
419
+ return typeof value === "string" && !isNaN(Date.parse(value));
420
+ };
418
421
  var removeTypename = (obj) => {
422
+ if (obj instanceof Date) {
423
+ return obj;
424
+ }
425
+ if (isIsoDateString(obj)) {
426
+ return obj;
427
+ }
419
428
  if (Array.isArray(obj)) {
420
- return obj.map((item) => removeTypename(item));
421
- } else if (obj !== null && typeof obj === "object") {
429
+ return obj.map(removeTypename);
430
+ }
431
+ if (obj !== null && typeof obj === "object") {
422
432
  const { __typename, ...cleanedObj } = obj;
423
- return Object.keys(cleanedObj).reduce(
424
- (acc, key) => {
425
- acc[key] = removeTypename(cleanedObj[key]);
426
- return acc;
427
- },
428
- {}
429
- );
433
+ return Object.keys(cleanedObj).reduce((acc, key) => {
434
+ acc[key] = removeTypename(cleanedObj[key]);
435
+ return acc;
436
+ }, {});
430
437
  }
431
438
  return obj;
432
439
  };