@wikicasa-dev/utilities 1.0.8 → 1.0.9
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/ObjectUtils.cjs +1 -1
- package/dist/ObjectUtils.js +20 -15
- package/dist/index.cjs +1 -1
- package/dist/index.js +49 -48
- package/dist/utils/ObjectUtils.d.ts +1 -0
- package/package.json +1 -1
package/dist/ObjectUtils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(e,n){if(e)for(const t in e)n[t]=e[t]}function c(e){return!e||!Object.keys(e).length}function s(e){if(!e)return null;for(const n in e){const t=e[n];if(t&&(Array.isArray(t)||Object.keys(t).length>0))return JSON.parse(JSON.stringify(e))}return{...e}}const u=e=>Object.entries(e).reduce((n,[t,r])=>(n[r]=t,n),{});exports.deepCopy=s;exports.invertObject=u;exports.isEmptyObject=c;exports.shallowCopyObjectTo=i;
|
package/dist/ObjectUtils.js
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
function
|
|
2
|
-
if (
|
|
3
|
-
for (const t in
|
|
4
|
-
|
|
1
|
+
function i(e, n) {
|
|
2
|
+
if (e)
|
|
3
|
+
for (const t in e)
|
|
4
|
+
n[t] = e[t];
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return !
|
|
6
|
+
function c(e) {
|
|
7
|
+
return !e || !Object.keys(e).length;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (!
|
|
9
|
+
function s(e) {
|
|
10
|
+
if (!e)
|
|
11
11
|
return null;
|
|
12
|
-
for (const
|
|
13
|
-
const t = n
|
|
12
|
+
for (const n in e) {
|
|
13
|
+
const t = e[n];
|
|
14
14
|
if (t && (Array.isArray(t) || Object.keys(t).length > 0))
|
|
15
|
-
return JSON.parse(JSON.stringify(
|
|
15
|
+
return JSON.parse(JSON.stringify(e));
|
|
16
16
|
}
|
|
17
|
-
return { ...
|
|
17
|
+
return { ...e };
|
|
18
18
|
}
|
|
19
|
+
const u = (e) => Object.entries(e).reduce(
|
|
20
|
+
(n, [t, r]) => (n[r] = t, n),
|
|
21
|
+
{}
|
|
22
|
+
);
|
|
19
23
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
s as deepCopy,
|
|
25
|
+
u as invertObject,
|
|
26
|
+
c as isEmptyObject,
|
|
27
|
+
i as shallowCopyObjectTo
|
|
23
28
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./ArrayUtils.cjs"),O=require("./ColorUtils.cjs"),
|
|
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"),l=require("./ObjectUtils.cjs"),R=require("./ObserverUtils.cjs"),m=require("./PermissionUtils.cjs"),a=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"),U=require("./DownloadUtils.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=l.deepCopy;exports.invertObject=l.invertObject;exports.isEmptyObject=l.isEmptyObject;exports.shallowCopyObjectTo=l.shallowCopyObjectTo;exports.observeOnce=R.observeOnce;exports.addPermissionStateListener=m.addPermissionStateListener;exports.onNotificationsPermissionChange=m.onNotificationsPermissionChange;exports.buildParams=a.buildParams;exports.buildParamsForAgency=a.buildParamsForAgency;exports.buildURL=a.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;exports.downloadFile=U.downloadFile;
|
package/dist/index.js
CHANGED
|
@@ -3,82 +3,83 @@ import { rgba as m } from "./ColorUtils.js";
|
|
|
3
3
|
import { decodeCookie as a, encodeCookie as E, getCookie as p, removeCookie as f } from "./CookieUtils.js";
|
|
4
4
|
import { formatCurrency as l } from "./CurrencyUtils.js";
|
|
5
5
|
import { formatDate as x } from "./DateUtils.js";
|
|
6
|
-
import { getCurrentDeviceSize as
|
|
6
|
+
import { getCurrentDeviceSize as d, isMobile as b, isSafari as O, isiOSDevice as u } from "./DeviceDetectionUtils.js";
|
|
7
7
|
import { emptyElem as R, getSingleElement as g, hideElem as S, showElem as _ } from "./DOMUtils.js";
|
|
8
8
|
import { hash256 as G, hashEmail as X } from "./EmailUtils.js";
|
|
9
9
|
import { debounce as T, isPromise as h } from "./FunctionUtils.js";
|
|
10
10
|
import { awaitableSetTimeout as y, createCustomEvent as N } from "./GenericUtils.js";
|
|
11
|
-
import { formatFloat as
|
|
12
|
-
import { deepCopy as H,
|
|
13
|
-
import { observeOnce as
|
|
14
|
-
import { addPermissionStateListener as
|
|
15
|
-
import { buildParams as
|
|
16
|
-
import { capitalizeFirstLetter as
|
|
17
|
-
import { appendQueryString as
|
|
18
|
-
import { COMPETITOR_REGEX as
|
|
19
|
-
import { browserSupportGeolocation as
|
|
20
|
-
import { formatAddress as
|
|
21
|
-
import { googlePlaceConverter as
|
|
22
|
-
import { downloadFile as
|
|
11
|
+
import { formatFloat as D, formatInteger as I, formatLocaleNumber as M, formatNumber as k, formatterNumberObj as w, parseLocaleNumber as j } from "./NumberUtils.js";
|
|
12
|
+
import { deepCopy as H, invertObject as U, isEmptyObject as z, shallowCopyObjectTo as Q } from "./ObjectUtils.js";
|
|
13
|
+
import { observeOnce as B } from "./ObserverUtils.js";
|
|
14
|
+
import { addPermissionStateListener as J, onNotificationsPermissionChange as K } from "./PermissionUtils.js";
|
|
15
|
+
import { buildParams as Y, buildParamsForAgency as Z, buildURL as $ } from "./RESB_UrlBuilder.js";
|
|
16
|
+
import { capitalizeFirstLetter as oe, cleanASCII as re, decodeTextWithEntities 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 xe, EXCLUDED_REGEX as ce, GLOBAL_PHONE_REGEX as de, PASSWORD_REGEX as be, PHONE_REGEX as Oe, ROOMS_REGEX as ue, SQM_REGEX as Ce } from "./RegexUtils.js";
|
|
19
|
+
import { browserSupportGeolocation as ge, getUserPosition as Se } from "./GeolocationUtils.js";
|
|
20
|
+
import { formatAddress as Ae, formattedAddress as Ge } from "./AdressUtils.js";
|
|
21
|
+
import { googlePlaceConverter as Pe } from "./GAutocompleteUtils.js";
|
|
22
|
+
import { downloadFile as he } from "./DownloadUtils.js";
|
|
23
23
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
se as COMPETITOR_REGEX,
|
|
25
|
+
le as DATE_REGEX,
|
|
26
|
+
ne as EMAIL_REGEX,
|
|
27
|
+
xe as EMAIL_REGEX_INTO_TEXT,
|
|
28
|
+
ce as EXCLUDED_REGEX,
|
|
29
29
|
de as GLOBAL_PHONE_REGEX,
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
be as PASSWORD_REGEX,
|
|
31
|
+
Oe as PHONE_REGEX,
|
|
32
32
|
ue as ROOMS_REGEX,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
Ce as SQM_REGEX,
|
|
34
|
+
J as addPermissionStateListener,
|
|
35
|
+
pe as appendQueryString,
|
|
36
36
|
y as awaitableSetTimeout,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
ge as browserSupportGeolocation,
|
|
38
|
+
Y as buildParams,
|
|
39
|
+
Z as buildParamsForAgency,
|
|
40
|
+
$ as buildURL,
|
|
41
|
+
oe as capitalizeFirstLetter,
|
|
42
|
+
re as cleanASCII,
|
|
43
43
|
N as createCustomEvent,
|
|
44
44
|
T as debounce,
|
|
45
45
|
a as decodeCookie,
|
|
46
|
-
|
|
46
|
+
te as decodeTextWithEntities,
|
|
47
47
|
H as deepCopy,
|
|
48
|
-
|
|
48
|
+
he as downloadFile,
|
|
49
49
|
R as emptyElem,
|
|
50
50
|
E as encodeCookie,
|
|
51
|
-
|
|
51
|
+
Ae as formatAddress,
|
|
52
52
|
l as formatCurrency,
|
|
53
53
|
x as formatDate,
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
D as formatFloat,
|
|
55
|
+
I as formatInteger,
|
|
56
56
|
M as formatLocaleNumber,
|
|
57
57
|
k as formatNumber,
|
|
58
|
-
|
|
58
|
+
Ge as formattedAddress,
|
|
59
59
|
w as formatterNumberObj,
|
|
60
60
|
p as getCookie,
|
|
61
|
-
|
|
61
|
+
d as getCurrentDeviceSize,
|
|
62
62
|
g as getSingleElement,
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
Se as getUserPosition,
|
|
64
|
+
Pe as googlePlaceConverter,
|
|
65
65
|
G as hash256,
|
|
66
66
|
X as hashEmail,
|
|
67
67
|
S as hideElem,
|
|
68
|
+
U as invertObject,
|
|
68
69
|
r as isArrNullOrEmpty,
|
|
69
|
-
|
|
70
|
+
z as isEmptyObject,
|
|
70
71
|
b as isMobile,
|
|
71
72
|
h as isPromise,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
O as isSafari,
|
|
74
|
+
u as isiOSDevice,
|
|
75
|
+
B as observeOnce,
|
|
76
|
+
K as onNotificationsPermissionChange,
|
|
77
|
+
j as parseLocaleNumber,
|
|
77
78
|
f as removeCookie,
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
me as replaceAll,
|
|
80
|
+
ie as replaceAllTokens,
|
|
80
81
|
m as rgba,
|
|
81
|
-
|
|
82
|
+
Q as shallowCopyObjectTo,
|
|
82
83
|
_ as showElem,
|
|
83
|
-
|
|
84
|
+
ae as stringToHyphened
|
|
84
85
|
};
|
|
@@ -6,3 +6,4 @@ export declare function isEmptyObject(obj: any): boolean;
|
|
|
6
6
|
* Otherwise, to ensure the deep copy of nested objects and arrays, we will use JSON.parse and JSON.stringify (slower).
|
|
7
7
|
* */
|
|
8
8
|
export declare function deepCopy<T>(objToCopy: T): T | null;
|
|
9
|
+
export declare const invertObject: <TRes, T extends Record<TKey, TValue>, TKey extends PropertyKey = PropertyKey, TValue extends string | number = string | number>(obj: T) => TRes;
|