@wikicasa-dev/utilities 1.1.6 → 1.1.7
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/StringUtils.cjs +1 -1
- package/dist/StringUtils.js +10 -6
- package/dist/index.cjs +1 -1
- package/dist/index.js +38 -37
- package/dist/utils/StringUtils.d.ts +8 -0
- package/package.json +1 -1
package/dist/StringUtils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(e,t,n){return e.replace(new RegExp(t,"g"),n)}function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(e,t,n){return e.replace(new RegExp(t,"g"),n)}function o(e){return e.charAt(0).toUpperCase()+e.slice(1)}function i(e){if(!e)return"";const t=document.createElement("span");return t.innerHTML=e,t.textContent||""}function l(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 p=(e="")=>!e||!e.trim()?"":(e=e.trim(),e.replace(" ","-").toLowerCase()),u=(e,t)=>{const n=e.toLowerCase(),r=new RegExp(`^${t}+|${t}+$`,"g");return n.replace(r,"")};exports.capitalizeFirstLetter=o;exports.cleanASCII=a;exports.decodeTextWithEntities=i;exports.replaceAll=c;exports.replaceAllTokens=l;exports.stringToHyphened=p;exports.strip=u;
|
package/dist/StringUtils.js
CHANGED
|
@@ -9,7 +9,7 @@ function a(e) {
|
|
|
9
9
|
const n = document.createElement("span");
|
|
10
10
|
return n.innerHTML = e, n.textContent || "";
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function p(e, n) {
|
|
13
13
|
const r = new RegExp(
|
|
14
14
|
Object.keys(n).map((t) => t.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&")).join("|"),
|
|
15
15
|
"gi"
|
|
@@ -18,15 +18,19 @@ function u(e, n) {
|
|
|
18
18
|
return n[t.toLowerCase()];
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function u(e) {
|
|
22
22
|
return e.replace(/[\uA78C\uA78B]/g, "'").replace(/[^\x00-\x7F]/g, "");
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const i = (e = "") => !e || !e.trim() ? "" : (e = e.trim(), e.replace(" ", "-").toLowerCase()), l = (e, n) => {
|
|
25
|
+
const r = e.toLowerCase(), t = new RegExp(`^${n}+|${n}+$`, "g");
|
|
26
|
+
return r.replace(t, "");
|
|
27
|
+
};
|
|
25
28
|
export {
|
|
26
29
|
o as capitalizeFirstLetter,
|
|
27
|
-
|
|
30
|
+
u as cleanASCII,
|
|
28
31
|
a as decodeTextWithEntities,
|
|
29
32
|
c as replaceAll,
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
p as replaceAllTokens,
|
|
34
|
+
i as stringToHyphened,
|
|
35
|
+
l as strip
|
|
32
36
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./ArrayUtils.cjs"),O=require("./ColorUtils.cjs"),a=require("./CookieUtils.cjs"),C=require("./CurrencyUtils.cjs"),n=require("./DateUtils.cjs"),s=require("./DeviceDetectionUtils.cjs"),l=require("./DOMUtils.cjs"),c=require("./EmailUtils.cjs"),E=require("./FunctionUtils.cjs"),u=require("./GenericUtils.cjs"),t=require("./NumberUtils.cjs"),o=require("./ObjectUtils.cjs"),S=require("./ObserverUtils.cjs"),m=require("./PermissionUtils.cjs"),d=require("./RESB_UrlBuilder.cjs"),r=require("./StringUtils.cjs"),y=require("./URLBuilderUtils.cjs"),e=require("./RegexUtils.cjs"),g=require("./GeolocationUtils.cjs"),b=require("./AdressUtils.cjs"),P=require("./GAutocompleteUtils.cjs"),U=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=C.formatCurrency;exports.formatDate=n.formatDate;exports.formatDateToddMMYYYY=n.formatDateToddMMYYYY;exports.getStartAndEndOfDayUTC=n.getStartAndEndOfDayUTC;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=c.hash256;exports.hashEmail=c.hashEmail;exports.debounce=E.debounce;exports.isPromise=E.isPromise;exports.awaitableSetTimeout=u.awaitableSetTimeout;exports.createCustomEvent=u.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=o.deepCopy;exports.getOrNull=o.getOrNull;exports.invertFlatObject=o.invertFlatObject;exports.invertKeyToValue=o.invertKeyToValue;exports.isEmptyObject=o.isEmptyObject;exports.shallowCopyObjectTo=o.shallowCopyObjectTo;exports.observeOnce=S.observeOnce;exports.addPermissionStateListener=m.addPermissionStateListener;exports.onNotificationsPermissionChange=m.onNotificationsPermissionChange;exports.buildParams=d.buildParams;exports.buildURL=d.buildURL;exports.capitalizeFirstLetter=r.capitalizeFirstLetter;exports.cleanASCII=r.cleanASCII;exports.decodeTextWithEntities=r.decodeTextWithEntities;exports.replaceAll=r.replaceAll;exports.replaceAllTokens=r.replaceAllTokens;exports.stringToHyphened=r.stringToHyphened;exports.strip=r.strip;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=P.googlePlaceConverter;exports.downloadFile=U.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,6 +1,6 @@
|
|
|
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
|
|
3
|
+
import { decodeCookie as i, encodeCookie as p, getCookie as l, removeCookie as n } from "./CookieUtils.js";
|
|
4
4
|
import { formatCurrency as E } from "./CurrencyUtils.js";
|
|
5
5
|
import { formatDate as c, formatDateToddMMYYYY as d, getStartAndEndOfDayUTC as x, subtractDaysFromDate as u } from "./DateUtils.js";
|
|
6
6
|
import { getCurrentDeviceSize as b, isMobile as O, isSafari as C, isWindows as P, isiOSDevice as S } from "./DeviceDetectionUtils.js";
|
|
@@ -13,44 +13,44 @@ import { deepCopy as B, getOrNull as K, invertFlatObject as V, invertKeyToValue
|
|
|
13
13
|
import { observeOnce as ee } from "./ObserverUtils.js";
|
|
14
14
|
import { addPermissionStateListener as re, onNotificationsPermissionChange as te } from "./PermissionUtils.js";
|
|
15
15
|
import { buildParams as me, buildURL as ie } from "./RESB_UrlBuilder.js";
|
|
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
|
|
23
|
-
import { calcPolygonCenter as
|
|
16
|
+
import { capitalizeFirstLetter as le, cleanASCII as ne, decodeTextWithEntities as se, replaceAll as Ee, replaceAllTokens as fe, stringToHyphened as ce, strip 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 Ce, EMAIL_REGEX_INTO_TEXT as Pe, EXCLUDED_REGEX as Se, GLOBAL_PHONE_REGEX as ye, PASSWORD_REGEX as Ae, PHONE_REGEX as Le, ROOMS_REGEX as Re, 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 Fe, encodePolygon as je, getMinMaxLatLng as Ue, getPolygonString as Ye, parsePoints as He, removeDuplicatePoints as We } from "./MapUtils.js";
|
|
24
24
|
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
be as COMPETITOR_REGEX,
|
|
26
|
+
Oe as DATE_REGEX,
|
|
27
|
+
Ce as EMAIL_REGEX,
|
|
28
|
+
Pe as EMAIL_REGEX_INTO_TEXT,
|
|
29
|
+
Se 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
|
+
Te as SQM_REGEX,
|
|
35
35
|
re as addPermissionStateListener,
|
|
36
|
-
|
|
36
|
+
ue as appendQueryString,
|
|
37
37
|
v as awaitableSetTimeout,
|
|
38
|
-
|
|
38
|
+
De as browserSupportGeolocation,
|
|
39
39
|
me as buildParams,
|
|
40
40
|
ie as buildURL,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
Fe as calcPolygonCenter,
|
|
42
|
+
le as capitalizeFirstLetter,
|
|
43
|
+
ne as cleanASCII,
|
|
44
44
|
I as createCustomEvent,
|
|
45
45
|
X as debounce,
|
|
46
46
|
i as decodeCookie,
|
|
47
47
|
se as decodeTextWithEntities,
|
|
48
48
|
B as deepCopy,
|
|
49
|
-
|
|
49
|
+
we as downloadFile,
|
|
50
50
|
A as emptyElem,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
p as encodeCookie,
|
|
52
|
+
je as encodePolygon,
|
|
53
|
+
Xe as formatAddress,
|
|
54
54
|
E as formatCurrency,
|
|
55
55
|
c as formatDate,
|
|
56
56
|
d as formatDateToddMMYYYY,
|
|
@@ -59,17 +59,17 @@ export {
|
|
|
59
59
|
j as formatLocaleNumber,
|
|
60
60
|
U as formatLocaleNumberAuto,
|
|
61
61
|
Y as formatNumber,
|
|
62
|
-
|
|
62
|
+
he as formattedAddress,
|
|
63
63
|
H as formatterNumberObj,
|
|
64
|
-
|
|
64
|
+
l as getCookie,
|
|
65
65
|
b as getCurrentDeviceSize,
|
|
66
|
-
|
|
66
|
+
Ue as getMinMaxLatLng,
|
|
67
67
|
K as getOrNull,
|
|
68
|
-
|
|
68
|
+
Ye as getPolygonString,
|
|
69
69
|
L as getSingleElement,
|
|
70
70
|
x as getStartAndEndOfDayUTC,
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
Ge as getUserPosition,
|
|
72
|
+
ve as googlePlaceConverter,
|
|
73
73
|
D as hash256,
|
|
74
74
|
G as hashEmail,
|
|
75
75
|
R as hideElem,
|
|
@@ -86,14 +86,15 @@ export {
|
|
|
86
86
|
te as onNotificationsPermissionChange,
|
|
87
87
|
W as parseLocaleNumber,
|
|
88
88
|
z as parseLocaleNumberAuto,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
He as parsePoints,
|
|
90
|
+
n as removeCookie,
|
|
91
|
+
We as removeDuplicatePoints,
|
|
92
92
|
Ee as replaceAll,
|
|
93
93
|
fe as replaceAllTokens,
|
|
94
94
|
a as rgba,
|
|
95
95
|
Z as shallowCopyObjectTo,
|
|
96
96
|
T as showElem,
|
|
97
97
|
ce as stringToHyphened,
|
|
98
|
+
de as strip,
|
|
98
99
|
u as subtractDaysFromDate
|
|
99
100
|
};
|
|
@@ -16,3 +16,11 @@ export declare function decodeTextWithEntities(strWithEntities: string | null):
|
|
|
16
16
|
export declare function replaceAllTokens(str: string, mapObj: Record<string, string>): string;
|
|
17
17
|
export declare function cleanASCII(str: string): string;
|
|
18
18
|
export declare const stringToHyphened: (str?: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Removes specified characters from the beginning and end of a string.
|
|
21
|
+
*
|
|
22
|
+
* @param str The input string to strip characters from.
|
|
23
|
+
* @param charToRemove The character to be removed from start and end.
|
|
24
|
+
* @returns The input string with specified chars removed from start/end and converted to lowercase.
|
|
25
|
+
*/
|
|
26
|
+
export declare const strip: (str: string, charToRemove: string) => string;
|