@wikicasa-dev/utilities 1.0.4 → 1.0.6

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./StringUtils.cjs");function f(d,s,o,n){const i=[];d&&d!=="ND"&&(s&&s!=="ND"&&s!=="0"?i.push(`${d} ${s}`):i.push(d)),o&&n?i.push(`${o} (${n})`):i.push(o);const t=i.filter(r=>!!r).join(", ");return l.capitalizeFirstLetter(t)}const u=(d,s,o,n)=>s?f(s,o||"",n):d;exports.formatAddress=f;exports.formattedAddress=u;
@@ -0,0 +1,12 @@
1
+ import { capitalizeFirstLetter as h } from "./StringUtils.js";
2
+ function l(s, o, f, i) {
3
+ const d = [];
4
+ s && s !== "ND" && (o && o !== "ND" && o !== "0" ? d.push(`${s} ${o}`) : d.push(s)), f && i ? d.push(`${f} (${i})`) : d.push(f);
5
+ const n = d.filter((p) => !!p).join(", ");
6
+ return h(n);
7
+ }
8
+ const u = (s, o, f, i) => o ? l(o, f || "", i) : s;
9
+ export {
10
+ l as formatAddress,
11
+ u as formattedAddress
12
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./StringUtils.cjs"),i=async(t,o,n)=>{const s={};for(let e=0;e<t.address_components.length;e++)t.address_components[e].types.indexOf("administrative_area_level_3")!==-1?s.city=t.address_components[e].long_name:t.address_components[e].types.indexOf("locality")!==-1?s.locality=t.address_components[e].long_name:t.address_components[e].types.indexOf("route")!==-1?s.streetName=t.address_components[e].long_name:t.address_components[e].types.indexOf("street_number")!==-1?s.streetNumber=t.address_components[e].long_name:t.address_components[e].types.indexOf("postal_code")!==-1&&(s.zip=t.address_components[e].long_name);if(s.latitude=t.geometry.location.lat,s.longitude=t.geometry.location.lng,s.address=d.cleanASCII(o),typeof s.streetNumber>"u"&&(s.streetNumber=null),delete n.city,delete n.locality,n={...n,...s},!n.streetNumber){const e=parseInt(n.address.split(",")[1]),r=parseInt(n.zip);e&&e!==r&&(n.streetNumber=e.toString())}return n};exports.googlePlaceConverter=i;
@@ -0,0 +1,16 @@
1
+ import { cleanASCII as d } from "./StringUtils.js";
2
+ const m = async (t, o, n) => {
3
+ const s = {};
4
+ for (let e = 0; e < t.address_components.length; e++)
5
+ t.address_components[e].types.indexOf(
6
+ "administrative_area_level_3"
7
+ ) !== -1 ? s.city = t.address_components[e].long_name : t.address_components[e].types.indexOf("locality") !== -1 ? s.locality = t.address_components[e].long_name : t.address_components[e].types.indexOf("route") !== -1 ? s.streetName = t.address_components[e].long_name : t.address_components[e].types.indexOf("street_number") !== -1 ? s.streetNumber = t.address_components[e].long_name : t.address_components[e].types.indexOf("postal_code") !== -1 && (s.zip = t.address_components[e].long_name);
8
+ if (s.latitude = t.geometry.location.lat, s.longitude = t.geometry.location.lng, s.address = d(o), typeof s.streetNumber > "u" && (s.streetNumber = null), delete n.city, delete n.locality, n = { ...n, ...s }, !n.streetNumber) {
9
+ const e = parseInt(n.address.split(",")[1]), r = parseInt(n.zip);
10
+ e && e !== r && (n.streetNumber = e.toString());
11
+ }
12
+ return n;
13
+ };
14
+ export {
15
+ m as googlePlaceConverter
16
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n={maximumAge:6*60*1e3,timeout:10*1e3},o=()=>!!window.navigator.geolocation,r=(t=n)=>{if(o())return new Promise((e,i)=>{navigator.geolocation.getCurrentPosition(e,i,t)})};exports.browserSupportGeolocation=o;exports.getUserPosition=r;
@@ -0,0 +1,19 @@
1
+ const i = {
2
+ //maximum age in milliseconds of a possible cached position
3
+ maximumAge: 36e4,
4
+ //--> 1 hour
5
+ //maximum length of time (in milliseconds) the device is allowed to take in order to return a position
6
+ timeout: 1e4
7
+ //--> 10 sec
8
+ }, n = () => !!window.navigator.geolocation, r = (o = i) => {
9
+ if (n())
10
+ return new Promise(
11
+ (t, e) => {
12
+ navigator.geolocation.getCurrentPosition(t, e, o);
13
+ }
14
+ );
15
+ };
16
+ export {
17
+ n as browserSupportGeolocation,
18
+ r as getUserPosition
19
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function p(e,n,t){return e.replace(new RegExp(n,"g"),t)}function c(e){return e.charAt(0).toUpperCase()+e.slice(1)}function u(e,n,t,r){const o=[];e&&e!=="ND"&&(n&&n!=="ND"&&n!=="0"?o.push(`${e} ${n}`):o.push(e)),t&&r?o.push(`${t} (${r})`):o.push(t);const i=o.filter(l=>!!l).join(", ");return c(i)}function a(e){if(!e)return"";const n=document.createElement("span");return n.innerHTML=e,n.textContent||""}function s(e,n){const t=new RegExp(Object.keys(n).map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|"),"gi");return e.replace(t,function(r){return n[r.toLowerCase()]})}function f(e){return e.replace(/[\uA78C\uA78B]/g,"'").replace(/[^\x00-\x7F]/g,"")}const d=(e="")=>!e||!e.trim()?"":(e=e.trim(),e.replace(" ","-").toLowerCase());exports.capitalizeFirstLetter=c;exports.cleanASCII=f;exports.decodeTextWithEntities=a;exports.formatAddress=u;exports.replaceAll=p;exports.replaceAllTokens=s;exports.stringToHyphened=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(e,t,n){return e.replace(new RegExp(t,"g"),n)}function i(e){return e.charAt(0).toUpperCase()+e.slice(1)}function l(e){if(!e)return"";const t=document.createElement("span");return t.innerHTML=e,t.textContent||""}function o(e,t){const n=new RegExp(Object.keys(t).map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|"),"gi");return e.replace(n,function(r){return t[r.toLowerCase()]})}function a(e){return e.replace(/[\uA78C\uA78B]/g,"'").replace(/[^\x00-\x7F]/g,"")}const u=(e="")=>!e||!e.trim()?"":(e=e.trim(),e.replace(" ","-").toLowerCase());exports.capitalizeFirstLetter=i;exports.cleanASCII=a;exports.decodeTextWithEntities=l;exports.replaceAll=c;exports.replaceAllTokens=o;exports.stringToHyphened=u;
@@ -1,40 +1,33 @@
1
- function p(e, n, r) {
1
+ function c(e, n, r) {
2
2
  return e.replace(new RegExp(n, "g"), r);
3
3
  }
4
- function i(e) {
4
+ function o(e) {
5
5
  return e.charAt(0).toUpperCase() + e.slice(1);
6
6
  }
7
- function l(e, n, r, o) {
8
- const t = [];
9
- e && e !== "ND" && (n && n !== "ND" && n !== "0" ? t.push(`${e} ${n}`) : t.push(e)), r && o ? t.push(`${r} (${o})`) : t.push(r);
10
- const c = t.filter((u) => !!u).join(", ");
11
- return i(c);
12
- }
13
7
  function a(e) {
14
8
  if (!e)
15
9
  return "";
16
10
  const n = document.createElement("span");
17
11
  return n.innerHTML = e, n.textContent || "";
18
12
  }
19
- function f(e, n) {
13
+ function u(e, n) {
20
14
  const r = new RegExp(
21
- Object.keys(n).map((o) => o.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")).join("|"),
15
+ Object.keys(n).map((t) => t.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")).join("|"),
22
16
  "gi"
23
17
  );
24
- return e.replace(r, function(o) {
25
- return n[o.toLowerCase()];
18
+ return e.replace(r, function(t) {
19
+ return n[t.toLowerCase()];
26
20
  });
27
21
  }
28
- function s(e) {
22
+ function i(e) {
29
23
  return e.replace(/[\uA78C\uA78B]/g, "'").replace(/[^\x00-\x7F]/g, "");
30
24
  }
31
- const d = (e = "") => !e || !e.trim() ? "" : (e = e.trim(), e.replace(" ", "-").toLowerCase());
25
+ const l = (e = "") => !e || !e.trim() ? "" : (e = e.trim(), e.replace(" ", "-").toLowerCase());
32
26
  export {
33
- i as capitalizeFirstLetter,
34
- s as cleanASCII,
27
+ o as capitalizeFirstLetter,
28
+ i as cleanASCII,
35
29
  a as decodeTextWithEntities,
36
- l as formatAddress,
37
- p as replaceAll,
38
- f as replaceAllTokens,
39
- d as stringToHyphened
30
+ c as replaceAll,
31
+ u as replaceAllTokens,
32
+ l as stringToHyphened
40
33
  };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./ArrayUtils.cjs"),d=require("./ColorUtils.cjs"),i=require("./CookieUtils.cjs"),b=require("./CurrencyUtils.cjs"),O=require("./DateUtils.cjs"),o=require("./DeviceDetectionUtils.cjs"),s=require("./DOMUtils.cjs"),l=require("./EmailUtils.cjs"),n=require("./FunctionUtils.cjs"),c=require("./GenericUtils.cjs"),t=require("./NumberUtils.cjs"),a=require("./ObjectUtils.cjs"),R=require("./ObserverUtils.cjs"),m=require("./PermissionUtils.cjs"),E=require("./RESB_UrlBuilder.cjs"),r=require("./StringUtils.cjs"),C=require("./URLBuilderUtils.cjs"),e=require("./RegexUtils.cjs");exports.isArrNullOrEmpty=u.isArrNullOrEmpty;exports.rgba=d.rgba;exports.decodeCookie=i.decodeCookie;exports.encodeCookie=i.encodeCookie;exports.getCookie=i.getCookie;exports.removeCookie=i.removeCookie;exports.formatCurrency=b.formatCurrency;exports.formatDate=O.formatDate;exports.getCurrentDeviceSize=o.getCurrentDeviceSize;exports.isMobile=o.isMobile;exports.isSafari=o.isSafari;exports.isiOSDevice=o.isiOSDevice;exports.emptyElem=s.emptyElem;exports.getSingleElement=s.getSingleElement;exports.hideElem=s.hideElem;exports.showElem=s.showElem;exports.hash256=l.hash256;exports.hashEmail=l.hashEmail;exports.debounce=n.debounce;exports.isPromise=n.isPromise;exports.awaitableSetTimeout=c.awaitableSetTimeout;exports.createCustomEvent=c.createCustomEvent;exports.formatFloat=t.formatFloat;exports.formatInteger=t.formatInteger;exports.formatLocaleNumber=t.formatLocaleNumber;exports.formatNumber=t.formatNumber;exports.formatterNumberObj=t.formatterNumberObj;exports.parseLocaleNumber=t.parseLocaleNumber;exports.deepCopy=a.deepCopy;exports.isEmptyObject=a.isEmptyObject;exports.shallowCopyObjectTo=a.shallowCopyObjectTo;exports.observeOnce=R.observeOnce;exports.addPermissionStateListener=m.addPermissionStateListener;exports.onNotificationsPermissionChange=m.onNotificationsPermissionChange;exports.buildParams=E.buildParams;exports.buildParamsForAgency=E.buildParamsForAgency;exports.buildURL=E.buildURL;exports.capitalizeFirstLetter=r.capitalizeFirstLetter;exports.cleanASCII=r.cleanASCII;exports.decodeTextWithEntities=r.decodeTextWithEntities;exports.formatAddress=r.formatAddress;exports.replaceAll=r.replaceAll;exports.replaceAllTokens=r.replaceAllTokens;exports.stringToHyphened=r.stringToHyphened;exports.appendQueryString=C.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;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./ArrayUtils.cjs"),O=require("./ColorUtils.cjs"),i=require("./CookieUtils.cjs"),p=require("./CurrencyUtils.cjs"),C=require("./DateUtils.cjs"),o=require("./DeviceDetectionUtils.cjs"),s=require("./DOMUtils.cjs"),n=require("./EmailUtils.cjs"),E=require("./FunctionUtils.cjs"),c=require("./GenericUtils.cjs"),r=require("./NumberUtils.cjs"),a=require("./ObjectUtils.cjs"),R=require("./ObserverUtils.cjs"),m=require("./PermissionUtils.cjs"),l=require("./RESB_UrlBuilder.cjs"),t=require("./StringUtils.cjs"),g=require("./URLBuilderUtils.cjs"),e=require("./RegexUtils.cjs"),u=require("./GeolocationUtils.cjs"),d=require("./AdressUtils.cjs"),S=require("./GAutocompleteUtils.cjs");exports.isArrNullOrEmpty=b.isArrNullOrEmpty;exports.rgba=O.rgba;exports.decodeCookie=i.decodeCookie;exports.encodeCookie=i.encodeCookie;exports.getCookie=i.getCookie;exports.removeCookie=i.removeCookie;exports.formatCurrency=p.formatCurrency;exports.formatDate=C.formatDate;exports.getCurrentDeviceSize=o.getCurrentDeviceSize;exports.isMobile=o.isMobile;exports.isSafari=o.isSafari;exports.isiOSDevice=o.isiOSDevice;exports.emptyElem=s.emptyElem;exports.getSingleElement=s.getSingleElement;exports.hideElem=s.hideElem;exports.showElem=s.showElem;exports.hash256=n.hash256;exports.hashEmail=n.hashEmail;exports.debounce=E.debounce;exports.isPromise=E.isPromise;exports.awaitableSetTimeout=c.awaitableSetTimeout;exports.createCustomEvent=c.createCustomEvent;exports.formatFloat=r.formatFloat;exports.formatInteger=r.formatInteger;exports.formatLocaleNumber=r.formatLocaleNumber;exports.formatNumber=r.formatNumber;exports.formatterNumberObj=r.formatterNumberObj;exports.parseLocaleNumber=r.parseLocaleNumber;exports.deepCopy=a.deepCopy;exports.isEmptyObject=a.isEmptyObject;exports.shallowCopyObjectTo=a.shallowCopyObjectTo;exports.observeOnce=R.observeOnce;exports.addPermissionStateListener=m.addPermissionStateListener;exports.onNotificationsPermissionChange=m.onNotificationsPermissionChange;exports.buildParams=l.buildParams;exports.buildParamsForAgency=l.buildParamsForAgency;exports.buildURL=l.buildURL;exports.capitalizeFirstLetter=t.capitalizeFirstLetter;exports.cleanASCII=t.cleanASCII;exports.decodeTextWithEntities=t.decodeTextWithEntities;exports.replaceAll=t.replaceAll;exports.replaceAllTokens=t.replaceAllTokens;exports.stringToHyphened=t.stringToHyphened;exports.appendQueryString=g.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=u.browserSupportGeolocation;exports.getUserPosition=u.getUserPosition;exports.formatAddress=d.formatAddress;exports.formattedAddress=d.formattedAddress;exports.googlePlaceConverter=S.googlePlaceConverter;
package/dist/index.d.ts CHANGED
@@ -16,3 +16,6 @@ export * from './utils/RESB_UrlBuilder';
16
16
  export * from './utils/StringUtils';
17
17
  export * from './utils/URLBuilderUtils';
18
18
  export * from './utils/RegexUtils';
19
+ export * from './utils/GeolocationUtils';
20
+ export * from './utils/AdressUtils';
21
+ export * from './utils/GAutocompleteUtils';
package/dist/index.js CHANGED
@@ -1,75 +1,82 @@
1
1
  import { isArrNullOrEmpty as r } from "./ArrayUtils.js";
2
2
  import { rgba as m } from "./ColorUtils.js";
3
- import { decodeCookie as a, encodeCookie as E, getCookie as p, removeCookie as f } from "./CookieUtils.js";
3
+ import { decodeCookie as a, encodeCookie as E, getCookie as p, removeCookie as s } from "./CookieUtils.js";
4
4
  import { formatCurrency as l } from "./CurrencyUtils.js";
5
- import { formatDate as c } from "./DateUtils.js";
6
- import { getCurrentDeviceSize as d, isMobile as b, isSafari as O, isiOSDevice as u } from "./DeviceDetectionUtils.js";
7
- import { emptyElem as C, getSingleElement as _, hideElem as S, showElem as X } from "./DOMUtils.js";
8
- import { hash256 as G, hashEmail as T } from "./EmailUtils.js";
9
- import { debounce as h, isPromise as L } from "./FunctionUtils.js";
10
- import { awaitableSetTimeout as N, createCustomEvent as P } from "./GenericUtils.js";
11
- import { formatFloat as I, formatInteger as M, formatLocaleNumber as k, formatNumber as v, formatterNumberObj as j, parseLocaleNumber as w } from "./NumberUtils.js";
12
- import { deepCopy as H, isEmptyObject as z, shallowCopyObjectTo as Q } from "./ObjectUtils.js";
5
+ import { formatDate as x } from "./DateUtils.js";
6
+ import { getCurrentDeviceSize as d, isMobile as b, isSafari as u, isiOSDevice as O } from "./DeviceDetectionUtils.js";
7
+ import { emptyElem as R, getSingleElement as g, hideElem as S, showElem as _ } from "./DOMUtils.js";
8
+ import { hash256 as G, hashEmail as X } from "./EmailUtils.js";
9
+ import { debounce as T, isPromise as h } from "./FunctionUtils.js";
10
+ import { awaitableSetTimeout as y, createCustomEvent as N } from "./GenericUtils.js";
11
+ import { formatFloat as I, formatInteger as v, formatLocaleNumber as M, formatNumber as k, formatterNumberObj as w, parseLocaleNumber as j } from "./NumberUtils.js";
12
+ import { deepCopy as H, isEmptyObject as U, shallowCopyObjectTo as z } from "./ObjectUtils.js";
13
13
  import { observeOnce as W } from "./ObserverUtils.js";
14
14
  import { addPermissionStateListener as q, onNotificationsPermissionChange as J } from "./PermissionUtils.js";
15
15
  import { buildParams as V, buildParamsForAgency as Y, buildURL as Z } from "./RESB_UrlBuilder.js";
16
- import { capitalizeFirstLetter as ee, cleanASCII as oe, decodeTextWithEntities as re, formatAddress as te, replaceAll as me, replaceAllTokens as ie, stringToHyphened as ae } from "./StringUtils.js";
17
- import { appendQueryString as pe } from "./URLBuilderUtils.js";
18
- import { COMPETITOR_REGEX as se, DATE_REGEX as le, EMAIL_REGEX as ne, EMAIL_REGEX_INTO_TEXT as ce, EXCLUDED_REGEX as xe, GLOBAL_PHONE_REGEX as de, PASSWORD_REGEX as be, PHONE_REGEX as Oe, ROOMS_REGEX as ue, SQM_REGEX as Re } from "./RegexUtils.js";
16
+ import { capitalizeFirstLetter as ee, cleanASCII as oe, decodeTextWithEntities as re, replaceAll as te, replaceAllTokens as me, stringToHyphened as ie } from "./StringUtils.js";
17
+ import { appendQueryString as Ee } from "./URLBuilderUtils.js";
18
+ import { COMPETITOR_REGEX as se, DATE_REGEX as fe, EMAIL_REGEX as le, EMAIL_REGEX_INTO_TEXT as ne, EXCLUDED_REGEX as xe, GLOBAL_PHONE_REGEX as ce, PASSWORD_REGEX as de, PHONE_REGEX as be, ROOMS_REGEX as ue, SQM_REGEX as Oe } from "./RegexUtils.js";
19
+ import { browserSupportGeolocation as Re, getUserPosition as ge } from "./GeolocationUtils.js";
20
+ import { formatAddress as _e, formattedAddress as Ae } from "./AdressUtils.js";
21
+ import { googlePlaceConverter as Xe } from "./GAutocompleteUtils.js";
19
22
  export {
20
23
  se as COMPETITOR_REGEX,
21
- le as DATE_REGEX,
22
- ne as EMAIL_REGEX,
23
- ce as EMAIL_REGEX_INTO_TEXT,
24
+ fe as DATE_REGEX,
25
+ le as EMAIL_REGEX,
26
+ ne as EMAIL_REGEX_INTO_TEXT,
24
27
  xe as EXCLUDED_REGEX,
25
- de as GLOBAL_PHONE_REGEX,
26
- be as PASSWORD_REGEX,
27
- Oe as PHONE_REGEX,
28
+ ce as GLOBAL_PHONE_REGEX,
29
+ de as PASSWORD_REGEX,
30
+ be as PHONE_REGEX,
28
31
  ue as ROOMS_REGEX,
29
- Re as SQM_REGEX,
32
+ Oe as SQM_REGEX,
30
33
  q as addPermissionStateListener,
31
- pe as appendQueryString,
32
- N as awaitableSetTimeout,
34
+ Ee as appendQueryString,
35
+ y as awaitableSetTimeout,
36
+ Re as browserSupportGeolocation,
33
37
  V as buildParams,
34
38
  Y as buildParamsForAgency,
35
39
  Z as buildURL,
36
40
  ee as capitalizeFirstLetter,
37
41
  oe as cleanASCII,
38
- P as createCustomEvent,
39
- h as debounce,
42
+ N as createCustomEvent,
43
+ T as debounce,
40
44
  a as decodeCookie,
41
45
  re as decodeTextWithEntities,
42
46
  H as deepCopy,
43
- C as emptyElem,
47
+ R as emptyElem,
44
48
  E as encodeCookie,
45
- te as formatAddress,
49
+ _e as formatAddress,
46
50
  l as formatCurrency,
47
- c as formatDate,
51
+ x as formatDate,
48
52
  I as formatFloat,
49
- M as formatInteger,
50
- k as formatLocaleNumber,
51
- v as formatNumber,
52
- j as formatterNumberObj,
53
+ v as formatInteger,
54
+ M as formatLocaleNumber,
55
+ k as formatNumber,
56
+ Ae as formattedAddress,
57
+ w as formatterNumberObj,
53
58
  p as getCookie,
54
59
  d as getCurrentDeviceSize,
55
- _ as getSingleElement,
60
+ g as getSingleElement,
61
+ ge as getUserPosition,
62
+ Xe as googlePlaceConverter,
56
63
  G as hash256,
57
- T as hashEmail,
64
+ X as hashEmail,
58
65
  S as hideElem,
59
66
  r as isArrNullOrEmpty,
60
- z as isEmptyObject,
67
+ U as isEmptyObject,
61
68
  b as isMobile,
62
- L as isPromise,
63
- O as isSafari,
64
- u as isiOSDevice,
69
+ h as isPromise,
70
+ u as isSafari,
71
+ O as isiOSDevice,
65
72
  W as observeOnce,
66
73
  J as onNotificationsPermissionChange,
67
- w as parseLocaleNumber,
68
- f as removeCookie,
69
- me as replaceAll,
70
- ie as replaceAllTokens,
74
+ j as parseLocaleNumber,
75
+ s as removeCookie,
76
+ te as replaceAll,
77
+ me as replaceAllTokens,
71
78
  m as rgba,
72
- Q as shallowCopyObjectTo,
73
- X as showElem,
74
- ae as stringToHyphened
79
+ z as shallowCopyObjectTo,
80
+ _ as showElem,
81
+ ie as stringToHyphened
75
82
  };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Formats the address based on the provided street name, street number, city name, and province acronym.
3
+ *
4
+ * @param streetName The name of the street.
5
+ * @param streetNumber The number of the street.
6
+ * @param cityName The name of the city.
7
+ * @param provinceAcronym The acronym of the province (optional).
8
+ * @returns The formatted address with capitalized first letters of each component.
9
+ */
10
+ export declare function formatAddress(streetName: string, streetNumber: string, cityName: string, provinceAcronym?: string): string;
11
+ /**
12
+ * Formats the address based on the provided parameters.
13
+ * If streetName is provided, it calls the formatAddress function with streetName, streetNumber, and cityName.
14
+ * If streetName is not provided, it returns the addressName.
15
+ *
16
+ * @param addressName - The name of the address.
17
+ * @param streetName - The name of the street.
18
+ * @param streetNumber - The number of the street.
19
+ * @param cityName - The name of the city.
20
+ * @returns The formatted address string.
21
+ */
22
+ export declare const formattedAddress: (addressName: string, streetName: string | undefined, streetNumber: string | undefined, cityName: string) => string;
@@ -0,0 +1,2 @@
1
+ import type { GPlaceDetails, Place } from "@wikicasa-dev/types";
2
+ export declare const googlePlaceConverter: (gPlace: GPlaceDetails, address: string, place: Place) => Promise<Place>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Checks if the browser supports geolocation.
3
+ * @returns A boolean indicating whether the browser supports geolocation.
4
+ */
5
+ export declare const browserSupportGeolocation: () => boolean;
6
+ /**
7
+ * Gets the user's geolocation position.
8
+ * @param options - The options for getting the geolocation position. Defaults to { maximumAge: 6*60*1000, timeout: 10*1000 }.
9
+ * @returns A promise that resolves with the geolocation position.
10
+ */
11
+ export declare const getUserPosition: (options?: PositionOptions) => Promise<GeolocationPosition> | undefined;
@@ -1,6 +1,11 @@
1
1
  export declare function replaceAll(str: string, find: string, replace: string): string;
2
+ /**
3
+ * Capitalizes the first letter of a given string.
4
+ *
5
+ * @param string The input string to capitalize the first letter.
6
+ * @returns The input string with the first letter capitalized.
7
+ */
2
8
  export declare function capitalizeFirstLetter(string: string): string;
3
- export declare function formatAddress(streetName: string, streetNumber: string, cityName: string, provinceAcronym?: string): string;
4
9
  export declare function decodeTextWithEntities(strWithEntities: string | null): string;
5
10
  /**
6
11
  * Replaces a given string with the values of the object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/utilities",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Wikicasa frontend utilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "typescript": "^5.4.3",
39
39
  "vite": "^5.2.3",
40
40
  "vite-plugin-dts": "^3.7.3",
41
- "@wikicasa-dev/types": "^1.2.1"
41
+ "@wikicasa-dev/types": "^1.2.2"
42
42
  },
43
43
  "dependencies": {
44
44
  "axios": "^1.4.0",