@wikicasa-dev/utilities 1.0.24 → 1.0.25

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.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./ArrayUtils.cjs"),O=require("./ColorUtils.cjs"),a=require("./CookieUtils.cjs"),P=require("./CurrencyUtils.cjs"),n=require("./DateUtils.cjs"),s=require("./DeviceDetectionUtils.cjs"),l=require("./DOMUtils.cjs"),u=require("./EmailUtils.cjs"),E=require("./FunctionUtils.cjs"),m=require("./GenericUtils.cjs"),t=require("./NumberUtils.cjs"),r=require("./ObjectUtils.cjs"),C=require("./ObserverUtils.cjs"),d=require("./PermissionUtils.cjs"),c=require("./RESB_UrlBuilder.cjs"),o=require("./StringUtils.cjs"),y=require("./URLBuilderUtils.cjs"),e=require("./RegexUtils.cjs"),g=require("./GeolocationUtils.cjs"),b=require("./AdressUtils.cjs"),S=require("./GAutocompleteUtils.cjs"),A=require("./DownloadUtils.cjs"),i=require("./MapUtils.cjs");exports.isArrNullOrEmpty=p.isArrNullOrEmpty;exports.rgba=O.rgba;exports.decodeCookie=a.decodeCookie;exports.encodeCookie=a.encodeCookie;exports.getCookie=a.getCookie;exports.removeCookie=a.removeCookie;exports.formatCurrency=P.formatCurrency;exports.formatDate=n.formatDate;exports.formatDateToddMMYYYY=n.formatDateToddMMYYYY;exports.subtractDaysFromDate=n.subtractDaysFromDate;exports.getCurrentDeviceSize=s.getCurrentDeviceSize;exports.isMobile=s.isMobile;exports.isSafari=s.isSafari;exports.isWindows=s.isWindows;exports.isiOSDevice=s.isiOSDevice;exports.emptyElem=l.emptyElem;exports.getSingleElement=l.getSingleElement;exports.hideElem=l.hideElem;exports.showElem=l.showElem;exports.hash256=u.hash256;exports.hashEmail=u.hashEmail;exports.debounce=E.debounce;exports.isPromise=E.isPromise;exports.awaitableSetTimeout=m.awaitableSetTimeout;exports.createCustomEvent=m.createCustomEvent;exports.formatFloat=t.formatFloat;exports.formatInteger=t.formatInteger;exports.formatLocaleNumber=t.formatLocaleNumber;exports.formatLocaleNumberAuto=t.formatLocaleNumberAuto;exports.formatNumber=t.formatNumber;exports.formatterNumberObj=t.formatterNumberObj;exports.parseLocaleNumber=t.parseLocaleNumber;exports.parseLocaleNumberAuto=t.parseLocaleNumberAuto;exports.deepCopy=r.deepCopy;exports.getOrNull=r.getOrNull;exports.invertFlatObject=r.invertFlatObject;exports.invertKeyToValue=r.invertKeyToValue;exports.isEmptyObject=r.isEmptyObject;exports.shallowCopyObjectTo=r.shallowCopyObjectTo;exports.observeOnce=C.observeOnce;exports.addPermissionStateListener=d.addPermissionStateListener;exports.onNotificationsPermissionChange=d.onNotificationsPermissionChange;exports.buildParams=c.buildParams;exports.buildParamsForAgency=c.buildParamsForAgency;exports.buildURL=c.buildURL;exports.capitalizeFirstLetter=o.capitalizeFirstLetter;exports.cleanASCII=o.cleanASCII;exports.decodeTextWithEntities=o.decodeTextWithEntities;exports.replaceAll=o.replaceAll;exports.replaceAllTokens=o.replaceAllTokens;exports.stringToHyphened=o.stringToHyphened;exports.appendQueryString=y.appendQueryString;exports.COMPETITOR_REGEX=e.COMPETITOR_REGEX;exports.DATE_REGEX=e.DATE_REGEX;exports.EMAIL_REGEX=e.EMAIL_REGEX;exports.EMAIL_REGEX_INTO_TEXT=e.EMAIL_REGEX_INTO_TEXT;exports.EXCLUDED_REGEX=e.EXCLUDED_REGEX;exports.GLOBAL_PHONE_REGEX=e.GLOBAL_PHONE_REGEX;exports.PASSWORD_REGEX=e.PASSWORD_REGEX;exports.PHONE_REGEX=e.PHONE_REGEX;exports.ROOMS_REGEX=e.ROOMS_REGEX;exports.SQM_REGEX=e.SQM_REGEX;exports.browserSupportGeolocation=g.browserSupportGeolocation;exports.getUserPosition=g.getUserPosition;exports.formatAddress=b.formatAddress;exports.formattedAddress=b.formattedAddress;exports.googlePlaceConverter=S.googlePlaceConverter;exports.downloadFile=A.downloadFile;exports.calcPolygonCenter=i.calcPolygonCenter;exports.encodePolygon=i.encodePolygon;exports.getMinMaxLatLng=i.getMinMaxLatLng;exports.getPolygonString=i.getPolygonString;exports.parsePoints=i.parsePoints;exports.removeDuplicatePoints=i.removeDuplicatePoints;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./ArrayUtils.cjs"),O=require("./ColorUtils.cjs"),a=require("./CookieUtils.cjs"),P=require("./CurrencyUtils.cjs"),l=require("./DateUtils.cjs"),s=require("./DeviceDetectionUtils.cjs"),n=require("./DOMUtils.cjs"),u=require("./EmailUtils.cjs"),E=require("./FunctionUtils.cjs"),m=require("./GenericUtils.cjs"),t=require("./NumberUtils.cjs"),r=require("./ObjectUtils.cjs"),C=require("./ObserverUtils.cjs"),d=require("./PermissionUtils.cjs"),c=require("./RESB_UrlBuilder.cjs"),o=require("./StringUtils.cjs"),y=require("./URLBuilderUtils.cjs"),e=require("./RegexUtils.cjs"),g=require("./GeolocationUtils.cjs"),b=require("./AdressUtils.cjs"),S=require("./GAutocompleteUtils.cjs"),A=require("./DownloadUtils.cjs"),i=require("./MapUtils.cjs");exports.isArrNullOrEmpty=p.isArrNullOrEmpty;exports.rgba=O.rgba;exports.decodeCookie=a.decodeCookie;exports.encodeCookie=a.encodeCookie;exports.getCookie=a.getCookie;exports.removeCookie=a.removeCookie;exports.formatCurrency=P.formatCurrency;exports.formatDate=l.formatDate;exports.formatDateToddMMYYYY=l.formatDateToddMMYYYY;exports.normalizeDate=l.normalizeDate;exports.subtractDaysFromDate=l.subtractDaysFromDate;exports.getCurrentDeviceSize=s.getCurrentDeviceSize;exports.isMobile=s.isMobile;exports.isSafari=s.isSafari;exports.isWindows=s.isWindows;exports.isiOSDevice=s.isiOSDevice;exports.emptyElem=n.emptyElem;exports.getSingleElement=n.getSingleElement;exports.hideElem=n.hideElem;exports.showElem=n.showElem;exports.hash256=u.hash256;exports.hashEmail=u.hashEmail;exports.debounce=E.debounce;exports.isPromise=E.isPromise;exports.awaitableSetTimeout=m.awaitableSetTimeout;exports.createCustomEvent=m.createCustomEvent;exports.formatFloat=t.formatFloat;exports.formatInteger=t.formatInteger;exports.formatLocaleNumber=t.formatLocaleNumber;exports.formatLocaleNumberAuto=t.formatLocaleNumberAuto;exports.formatNumber=t.formatNumber;exports.formatterNumberObj=t.formatterNumberObj;exports.parseLocaleNumber=t.parseLocaleNumber;exports.parseLocaleNumberAuto=t.parseLocaleNumberAuto;exports.deepCopy=r.deepCopy;exports.getOrNull=r.getOrNull;exports.invertFlatObject=r.invertFlatObject;exports.invertKeyToValue=r.invertKeyToValue;exports.isEmptyObject=r.isEmptyObject;exports.shallowCopyObjectTo=r.shallowCopyObjectTo;exports.observeOnce=C.observeOnce;exports.addPermissionStateListener=d.addPermissionStateListener;exports.onNotificationsPermissionChange=d.onNotificationsPermissionChange;exports.buildParams=c.buildParams;exports.buildParamsForAgency=c.buildParamsForAgency;exports.buildURL=c.buildURL;exports.capitalizeFirstLetter=o.capitalizeFirstLetter;exports.cleanASCII=o.cleanASCII;exports.decodeTextWithEntities=o.decodeTextWithEntities;exports.replaceAll=o.replaceAll;exports.replaceAllTokens=o.replaceAllTokens;exports.stringToHyphened=o.stringToHyphened;exports.appendQueryString=y.appendQueryString;exports.COMPETITOR_REGEX=e.COMPETITOR_REGEX;exports.DATE_REGEX=e.DATE_REGEX;exports.EMAIL_REGEX=e.EMAIL_REGEX;exports.EMAIL_REGEX_INTO_TEXT=e.EMAIL_REGEX_INTO_TEXT;exports.EXCLUDED_REGEX=e.EXCLUDED_REGEX;exports.GLOBAL_PHONE_REGEX=e.GLOBAL_PHONE_REGEX;exports.PASSWORD_REGEX=e.PASSWORD_REGEX;exports.PHONE_REGEX=e.PHONE_REGEX;exports.ROOMS_REGEX=e.ROOMS_REGEX;exports.SQM_REGEX=e.SQM_REGEX;exports.browserSupportGeolocation=g.browserSupportGeolocation;exports.getUserPosition=g.getUserPosition;exports.formatAddress=b.formatAddress;exports.formattedAddress=b.formattedAddress;exports.googlePlaceConverter=S.googlePlaceConverter;exports.downloadFile=A.downloadFile;exports.calcPolygonCenter=i.calcPolygonCenter;exports.encodePolygon=i.encodePolygon;exports.getMinMaxLatLng=i.getMinMaxLatLng;exports.getPolygonString=i.getPolygonString;exports.parsePoints=i.parsePoints;exports.removeDuplicatePoints=i.removeDuplicatePoints;
package/dist/index.js CHANGED
@@ -1,99 +1,100 @@
1
1
  import { isArrNullOrEmpty as r } from "./ArrayUtils.js";
2
2
  import { rgba as a } from "./ColorUtils.js";
3
- import { decodeCookie as i, encodeCookie as l, getCookie as p, removeCookie as s } from "./CookieUtils.js";
3
+ import { decodeCookie as i, encodeCookie as l, getCookie as n, removeCookie as p } from "./CookieUtils.js";
4
4
  import { formatCurrency as E } from "./CurrencyUtils.js";
5
- import { formatDate as c, formatDateToddMMYYYY as d, subtractDaysFromDate as x } from "./DateUtils.js";
6
- import { getCurrentDeviceSize as g, isMobile as b, isSafari as O, isWindows as P, isiOSDevice as C } from "./DeviceDetectionUtils.js";
7
- import { emptyElem as A, getSingleElement as L, hideElem as R, showElem as S } from "./DOMUtils.js";
8
- import { hash256 as _, hashEmail as G } from "./EmailUtils.js";
9
- import { debounce as X, isPromise as D } from "./FunctionUtils.js";
10
- import { awaitableSetTimeout as M, createCustomEvent as v } from "./GenericUtils.js";
11
- import { formatFloat as w, formatInteger as F, formatLocaleNumber as k, formatLocaleNumberAuto as j, formatNumber as Y, formatterNumberObj as H, parseLocaleNumber as U, parseLocaleNumberAuto as W } from "./NumberUtils.js";
12
- import { deepCopy as Q, getOrNull as B, invertFlatObject as K, invertKeyToValue as V, isEmptyObject as q, shallowCopyObjectTo as J } from "./ObjectUtils.js";
13
- import { observeOnce as $ } from "./ObserverUtils.js";
14
- import { addPermissionStateListener as oe, onNotificationsPermissionChange as re } from "./PermissionUtils.js";
15
- import { buildParams as ae, buildParamsForAgency as me, buildURL as ie } from "./RESB_UrlBuilder.js";
16
- import { capitalizeFirstLetter as pe, cleanASCII as se, decodeTextWithEntities as ne, replaceAll as Ee, replaceAllTokens as fe, stringToHyphened as ce } from "./StringUtils.js";
17
- import { appendQueryString as xe } from "./URLBuilderUtils.js";
18
- import { COMPETITOR_REGEX as ge, DATE_REGEX as be, EMAIL_REGEX as Oe, EMAIL_REGEX_INTO_TEXT as Pe, EXCLUDED_REGEX as Ce, GLOBAL_PHONE_REGEX as ye, PASSWORD_REGEX as Ae, PHONE_REGEX as Le, ROOMS_REGEX as Re, SQM_REGEX as Se } from "./RegexUtils.js";
19
- import { browserSupportGeolocation as _e, getUserPosition as Ge } from "./GeolocationUtils.js";
20
- import { formatAddress as Xe, formattedAddress as De } from "./AdressUtils.js";
21
- import { googlePlaceConverter as Me } from "./GAutocompleteUtils.js";
22
- import { downloadFile as Ie } from "./DownloadUtils.js";
23
- import { calcPolygonCenter as Fe, encodePolygon as ke, getMinMaxLatLng as je, getPolygonString as Ye, parsePoints as He, removeDuplicatePoints as Ue } from "./MapUtils.js";
5
+ import { formatDate as c, formatDateToddMMYYYY as d, normalizeDate as x, subtractDaysFromDate as u } from "./DateUtils.js";
6
+ import { getCurrentDeviceSize as b, isMobile as O, isSafari as P, isWindows as C, isiOSDevice as y } from "./DeviceDetectionUtils.js";
7
+ import { emptyElem as L, getSingleElement as R, hideElem as S, showElem as T } from "./DOMUtils.js";
8
+ import { hash256 as D, hashEmail as G } from "./EmailUtils.js";
9
+ import { debounce as X, isPromise as h } from "./FunctionUtils.js";
10
+ import { awaitableSetTimeout as v, createCustomEvent as I } from "./GenericUtils.js";
11
+ import { formatFloat as F, formatInteger as k, formatLocaleNumber as j, formatLocaleNumberAuto as Y, formatNumber as z, formatterNumberObj as H, parseLocaleNumber as U, parseLocaleNumberAuto as W } from "./NumberUtils.js";
12
+ import { deepCopy as B, getOrNull as K, invertFlatObject as V, invertKeyToValue as q, isEmptyObject as J, shallowCopyObjectTo as Z } from "./ObjectUtils.js";
13
+ import { observeOnce as ee } from "./ObserverUtils.js";
14
+ import { addPermissionStateListener as re, onNotificationsPermissionChange as te } from "./PermissionUtils.js";
15
+ import { buildParams as me, buildParamsForAgency as ie, buildURL as le } from "./RESB_UrlBuilder.js";
16
+ import { capitalizeFirstLetter as pe, cleanASCII as se, decodeTextWithEntities as Ee, replaceAll as fe, replaceAllTokens as ce, stringToHyphened as de } from "./StringUtils.js";
17
+ import { appendQueryString as ue } from "./URLBuilderUtils.js";
18
+ import { COMPETITOR_REGEX as be, DATE_REGEX as Oe, EMAIL_REGEX as Pe, EMAIL_REGEX_INTO_TEXT as Ce, EXCLUDED_REGEX as ye, GLOBAL_PHONE_REGEX as Ae, PASSWORD_REGEX as Le, PHONE_REGEX as Re, ROOMS_REGEX as Se, SQM_REGEX as Te } from "./RegexUtils.js";
19
+ import { browserSupportGeolocation as De, getUserPosition as Ge } from "./GeolocationUtils.js";
20
+ import { formatAddress as Xe, formattedAddress as he } from "./AdressUtils.js";
21
+ import { googlePlaceConverter as ve } from "./GAutocompleteUtils.js";
22
+ import { downloadFile as we } from "./DownloadUtils.js";
23
+ import { calcPolygonCenter as ke, encodePolygon as je, getMinMaxLatLng as Ye, getPolygonString as ze, parsePoints as He, removeDuplicatePoints as Ue } from "./MapUtils.js";
24
24
  export {
25
- ge as COMPETITOR_REGEX,
26
- be as DATE_REGEX,
27
- Oe as EMAIL_REGEX,
28
- Pe as EMAIL_REGEX_INTO_TEXT,
29
- Ce as EXCLUDED_REGEX,
30
- ye as GLOBAL_PHONE_REGEX,
31
- Ae as PASSWORD_REGEX,
32
- Le as PHONE_REGEX,
33
- Re as ROOMS_REGEX,
34
- Se as SQM_REGEX,
35
- oe as addPermissionStateListener,
36
- xe as appendQueryString,
37
- M as awaitableSetTimeout,
38
- _e as browserSupportGeolocation,
39
- ae as buildParams,
40
- me as buildParamsForAgency,
41
- ie as buildURL,
42
- Fe as calcPolygonCenter,
25
+ be as COMPETITOR_REGEX,
26
+ Oe as DATE_REGEX,
27
+ Pe as EMAIL_REGEX,
28
+ Ce as EMAIL_REGEX_INTO_TEXT,
29
+ ye as EXCLUDED_REGEX,
30
+ Ae as GLOBAL_PHONE_REGEX,
31
+ Le as PASSWORD_REGEX,
32
+ Re as PHONE_REGEX,
33
+ Se as ROOMS_REGEX,
34
+ Te as SQM_REGEX,
35
+ re as addPermissionStateListener,
36
+ ue as appendQueryString,
37
+ v as awaitableSetTimeout,
38
+ De as browserSupportGeolocation,
39
+ me as buildParams,
40
+ ie as buildParamsForAgency,
41
+ le as buildURL,
42
+ ke as calcPolygonCenter,
43
43
  pe as capitalizeFirstLetter,
44
44
  se as cleanASCII,
45
- v as createCustomEvent,
45
+ I as createCustomEvent,
46
46
  X as debounce,
47
47
  i as decodeCookie,
48
- ne as decodeTextWithEntities,
49
- Q as deepCopy,
50
- Ie as downloadFile,
51
- A as emptyElem,
48
+ Ee as decodeTextWithEntities,
49
+ B as deepCopy,
50
+ we as downloadFile,
51
+ L as emptyElem,
52
52
  l as encodeCookie,
53
- ke as encodePolygon,
53
+ je as encodePolygon,
54
54
  Xe as formatAddress,
55
55
  E as formatCurrency,
56
56
  c as formatDate,
57
57
  d as formatDateToddMMYYYY,
58
- w as formatFloat,
59
- F as formatInteger,
60
- k as formatLocaleNumber,
61
- j as formatLocaleNumberAuto,
62
- Y as formatNumber,
63
- De as formattedAddress,
58
+ F as formatFloat,
59
+ k as formatInteger,
60
+ j as formatLocaleNumber,
61
+ Y as formatLocaleNumberAuto,
62
+ z as formatNumber,
63
+ he as formattedAddress,
64
64
  H as formatterNumberObj,
65
- p as getCookie,
66
- g as getCurrentDeviceSize,
67
- je as getMinMaxLatLng,
68
- B as getOrNull,
69
- Ye as getPolygonString,
70
- L as getSingleElement,
65
+ n as getCookie,
66
+ b as getCurrentDeviceSize,
67
+ Ye as getMinMaxLatLng,
68
+ K as getOrNull,
69
+ ze as getPolygonString,
70
+ R as getSingleElement,
71
71
  Ge as getUserPosition,
72
- Me as googlePlaceConverter,
73
- _ as hash256,
72
+ ve as googlePlaceConverter,
73
+ D as hash256,
74
74
  G as hashEmail,
75
- R as hideElem,
76
- K as invertFlatObject,
77
- V as invertKeyToValue,
75
+ S as hideElem,
76
+ V as invertFlatObject,
77
+ q as invertKeyToValue,
78
78
  r as isArrNullOrEmpty,
79
- q as isEmptyObject,
80
- b as isMobile,
81
- D as isPromise,
82
- O as isSafari,
83
- P as isWindows,
84
- C as isiOSDevice,
85
- $ as observeOnce,
86
- re as onNotificationsPermissionChange,
79
+ J as isEmptyObject,
80
+ O as isMobile,
81
+ h as isPromise,
82
+ P as isSafari,
83
+ C as isWindows,
84
+ y as isiOSDevice,
85
+ x as normalizeDate,
86
+ ee as observeOnce,
87
+ te as onNotificationsPermissionChange,
87
88
  U as parseLocaleNumber,
88
89
  W as parseLocaleNumberAuto,
89
90
  He as parsePoints,
90
- s as removeCookie,
91
+ p as removeCookie,
91
92
  Ue as removeDuplicatePoints,
92
- Ee as replaceAll,
93
- fe as replaceAllTokens,
93
+ fe as replaceAll,
94
+ ce as replaceAllTokens,
94
95
  a as rgba,
95
- J as shallowCopyObjectTo,
96
- S as showElem,
97
- ce as stringToHyphened,
98
- x as subtractDaysFromDate
96
+ Z as shallowCopyObjectTo,
97
+ T as showElem,
98
+ de as stringToHyphened,
99
+ u as subtractDaysFromDate
99
100
  };
@@ -14,3 +14,23 @@ export declare const formatDateToddMMYYYY: (date: Date | string) => string;
14
14
  * @returns {Date} A new Date object representing the result of subtracting the specified days from the initial date.
15
15
  */
16
16
  export declare const subtractDaysFromDate: (initialDate: Date | undefined, days: number) => Date;
17
+ /**
18
+ * Normalizes a date string into a standardized format.
19
+ * Accepts different input formats and attempts to convert them to 'yyyy-MM-dd' format.
20
+ *
21
+ * @param {string} keyword - The string containing the date to normalize.
22
+ * Accepted formats:
23
+ * - yyyy-MM-dd
24
+ * - yyyy/MM/dd
25
+ * - dd/MM/yyyy
26
+ * - dd-MM-yyyy
27
+ *
28
+ * @returns {string|null} The normalized date in 'yyyy-MM-dd' format if valid,
29
+ * null if the date cannot be parsed in any of the supported formats.
30
+ *
31
+ * @example
32
+ * normalizeDate('2024-03-25') // returns '2024-03-25'
33
+ * normalizeDate('25/03/2024') // returns '2024-03-25'
34
+ * normalizeDate('invalid') // returns null
35
+ */
36
+ export declare function normalizeDate(keyword: string): string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/utilities",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "description": "Wikicasa frontend utilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",