@dxtmisha/functional-basic 1.6.4 → 1.7.1
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/CHANGELOG.md +12 -0
- package/dist/classes/ApiInstance.d.ts +3 -0
- package/dist/classes/ServerStorage.d.ts +2 -1
- package/dist/functions/getLast.d.ts +8 -0
- package/dist/library.d.ts +1 -0
- package/dist/library.js +78 -68
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.7.1] - 2026-07-14
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- **ApiInstance**: Refactored URL generation to use a protected `geo` (`GeoInstance`) field initialized via `Geo.getObject()`, calling instance-level methods instead of static `Geo` class methods.
|
|
9
|
+
- **ServerStorage**: Added an optional `storageList` parameter to `set()` and forwarded the resolved storage block from `get()` to prevent resolving the storage context multiple times.
|
|
10
|
+
|
|
11
|
+
## [1.7.0] - 2026-07-11
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
- **getLast**: Introduced a new `getLast` utility function to safely retrieve the last element from arrays or objects, with full bilingual JSDocs.
|
|
15
|
+
- **Tests**: Created a comprehensive unit test suite (`getLast.test.ts`) to validate last-element extraction across multiple data types.
|
|
16
|
+
|
|
5
17
|
## [1.6.2] - 2026-07-06
|
|
6
18
|
|
|
7
19
|
### Changed
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { GeoInstance } from './GeoInstance';
|
|
1
2
|
import { LoadingInstance } from './LoadingInstance';
|
|
2
3
|
import { ErrorCenterInstance } from './ErrorCenterInstance';
|
|
3
4
|
import { ApiDefault } from './ApiDefault';
|
|
@@ -36,6 +37,8 @@ export type ApiInstanceOptions = {
|
|
|
36
37
|
*/
|
|
37
38
|
export declare class ApiInstance {
|
|
38
39
|
protected url: string;
|
|
40
|
+
/** Geo class instance / Экземпляр класса Geo */
|
|
41
|
+
protected geo: GeoInstance;
|
|
39
42
|
/** Headers / Заголовки */
|
|
40
43
|
protected headers: ApiHeaders;
|
|
41
44
|
/** Default request parameters / Параметры запроса по умолчанию */
|
|
@@ -54,9 +54,10 @@ export declare class ServerStorage {
|
|
|
54
54
|
* @param key unique storage key / уникальный ключ хранилища
|
|
55
55
|
* @param value function that returns the value to save / функция, возвращающая значение для сохранения
|
|
56
56
|
* @param hydration whether the value should be included in hydration / должно ли значение быть включено в гидратацию
|
|
57
|
+
* @param storageList optional storage list / необязательный список хранилища
|
|
57
58
|
* @returns saved value / сохраненное значение
|
|
58
59
|
*/
|
|
59
|
-
static set<T = any>(key: string, value: () => T, hydration?: boolean): T;
|
|
60
|
+
static set<T = any>(key: string, value: () => T, hydration?: boolean, storageList?: ServerStorageList): T;
|
|
60
61
|
/**
|
|
61
62
|
* Sets the visibility of error messages.
|
|
62
63
|
*
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the last element of an array or object.
|
|
3
|
+
*
|
|
4
|
+
* Возвращает последний элемент массива или объекта.
|
|
5
|
+
* @param value input value / входное значение
|
|
6
|
+
* @returns last element of the array or object / последний элемент массива или объекта
|
|
7
|
+
*/
|
|
8
|
+
export declare function getLast<T>(value: T | T[] | Record<string, T>): T | undefined;
|
package/dist/library.d.ts
CHANGED
|
@@ -97,6 +97,7 @@ export * from './functions/getFirst';
|
|
|
97
97
|
export * from './functions/getHydrationData';
|
|
98
98
|
export * from './functions/getItemByPath';
|
|
99
99
|
export * from './functions/getKey';
|
|
100
|
+
export * from './functions/getLast';
|
|
100
101
|
export * from './functions/getLength';
|
|
101
102
|
export * from './functions/getLengthOfAllArray';
|
|
102
103
|
export * from './functions/getMaxLengthAllArray';
|
package/dist/library.js
CHANGED
|
@@ -539,14 +539,14 @@ var _e = "__ui:server-storage__", ve = "__ui:server:storage:id__", E = class {
|
|
|
539
539
|
static get(e, t, n = !1) {
|
|
540
540
|
let r = this.getStorage(void 0, `get:${e}`);
|
|
541
541
|
if (e in r) return r[e].value;
|
|
542
|
-
if (t) return this.set(e, t, n);
|
|
542
|
+
if (t) return this.set(e, t, n, r);
|
|
543
543
|
}
|
|
544
|
-
static set(e, t, n = !1) {
|
|
545
|
-
let
|
|
546
|
-
return
|
|
547
|
-
value:
|
|
544
|
+
static set(e, t, n = !1, r) {
|
|
545
|
+
let i = r || this.getStorage(void 0, `set:${e}`), a = t();
|
|
546
|
+
return i[e] = {
|
|
547
|
+
value: a,
|
|
548
548
|
hydration: n
|
|
549
|
-
},
|
|
549
|
+
}, a;
|
|
550
550
|
}
|
|
551
551
|
static setErrorStatus(e) {
|
|
552
552
|
this.hideError = e;
|
|
@@ -1613,9 +1613,9 @@ var Xe = "d-response-loading", Ze = class {
|
|
|
1613
1613
|
}
|
|
1614
1614
|
}, Qe = class {
|
|
1615
1615
|
constructor(e = "/api/", t = {}) {
|
|
1616
|
-
C(this, "url", void 0), C(this, "headers", void 0), C(this, "requestDefault", void 0), C(this, "status", void 0), C(this, "response", void 0), C(this, "preparation", void 0), C(this, "loading", void 0), C(this, "errorCenter", void 0), C(this, "hydration", void 0), C(this, "timeout", 16e3), C(this, "origin", void 0), C(this, "wrapper", void 0), this.url = e;
|
|
1616
|
+
C(this, "url", void 0), C(this, "geo", void 0), C(this, "headers", void 0), C(this, "requestDefault", void 0), C(this, "status", void 0), C(this, "response", void 0), C(this, "preparation", void 0), C(this, "loading", void 0), C(this, "errorCenter", void 0), C(this, "hydration", void 0), C(this, "timeout", 16e3), C(this, "origin", void 0), C(this, "wrapper", void 0), this.url = e;
|
|
1617
1617
|
let { headersClass: n = Ge, requestDefaultClass: r = Ve, statusClass: i = Re, responseClass: a = Ze, preparationClass: o = Je, loadingClass: s = M.getItem(), errorCenterClass: c = w.getItem(), hydrationClass: l = qe, wrapper: u } = t;
|
|
1618
|
-
this.headers = new n(), this.requestDefault = new r(), this.status = new i(), this.response = new a(this.requestDefault), this.preparation = new o(), this.loading = s, this.errorCenter = c, this.hydration = new l(), this.wrapper = u, this.hydration.initResponse(this.response);
|
|
1618
|
+
this.geo = k.getObject(), this.headers = new n(), this.requestDefault = new r(), this.status = new i(), this.response = new a(this.requestDefault), this.preparation = new o(), this.loading = s, this.errorCenter = c, this.hydration = new l(), this.wrapper = u, this.hydration.initResponse(this.response);
|
|
1619
1619
|
}
|
|
1620
1620
|
isLocalhost() {
|
|
1621
1621
|
return s() && typeof location < "u" && location.hostname === "localhost";
|
|
@@ -1633,7 +1633,7 @@ var Xe = "d-response-loading", Ze = class {
|
|
|
1633
1633
|
return this.origin && /^\//.test(this.url) ? `${this.origin}${this.url}` : this.url;
|
|
1634
1634
|
}
|
|
1635
1635
|
getUrl(e, t = !0) {
|
|
1636
|
-
return `${t ? this.getOrigin() : ""}${e}`.replace("{locale}",
|
|
1636
|
+
return `${t ? this.getOrigin() : ""}${e}`.replace("{locale}", this.geo.getLocation()).replace("{country}", this.geo.getCountry()).replace("{language}", this.geo.getLanguage());
|
|
1637
1637
|
}
|
|
1638
1638
|
getBody(e = {}, t = P.get) {
|
|
1639
1639
|
if (e instanceof FormData) return e;
|
|
@@ -4681,13 +4681,23 @@ function Pn(e) {
|
|
|
4681
4681
|
return (t = (n = e == null ? void 0 : e.key) == null ? e == null ? void 0 : e.code : n) == null ? e == null || (r = e.keyCode) == null ? void 0 : r.toString() : t;
|
|
4682
4682
|
}
|
|
4683
4683
|
//#endregion
|
|
4684
|
-
//#region src/functions/
|
|
4684
|
+
//#region src/functions/getLast.ts
|
|
4685
4685
|
function Fn(e) {
|
|
4686
|
+
if (i(e)) return e == null ? void 0 : e[e.length - 1];
|
|
4687
|
+
if (t(e)) {
|
|
4688
|
+
let t = Object.values(e);
|
|
4689
|
+
return t == null ? void 0 : t[t.length - 1];
|
|
4690
|
+
}
|
|
4691
|
+
return e;
|
|
4692
|
+
}
|
|
4693
|
+
//#endregion
|
|
4694
|
+
//#region src/functions/getLength.ts
|
|
4695
|
+
function In(e) {
|
|
4686
4696
|
return e == null ? 0 : typeof e == "string" || Array.isArray(e) ? e.length : e instanceof Map || e instanceof Set ? e.size : t(e) ? Object.keys(e).length : 0;
|
|
4687
4697
|
}
|
|
4688
4698
|
//#endregion
|
|
4689
4699
|
//#region src/functions/getLengthOfAllArray.ts
|
|
4690
|
-
function
|
|
4700
|
+
function Ln(e) {
|
|
4691
4701
|
return r(e, (e) => {
|
|
4692
4702
|
var t;
|
|
4693
4703
|
return (t = e == null ? void 0 : e.length) == null ? 0 : t;
|
|
@@ -4695,41 +4705,41 @@ function In(e) {
|
|
|
4695
4705
|
}
|
|
4696
4706
|
//#endregion
|
|
4697
4707
|
//#region src/functions/getMaxLengthAllArray.ts
|
|
4698
|
-
function
|
|
4708
|
+
function Rn(e) {
|
|
4699
4709
|
if (!l(e)) return 0;
|
|
4700
|
-
let t =
|
|
4710
|
+
let t = Ln(e);
|
|
4701
4711
|
return t.length > 1e4 ? t.reduce((e, t) => Math.max(e, t)) : Math.max(...t);
|
|
4702
4712
|
}
|
|
4703
4713
|
//#endregion
|
|
4704
4714
|
//#region src/functions/getMinLengthAllArray.ts
|
|
4705
|
-
function
|
|
4715
|
+
function zn(e) {
|
|
4706
4716
|
if (!l(e)) return 0;
|
|
4707
|
-
let t =
|
|
4717
|
+
let t = Ln(e);
|
|
4708
4718
|
return t.length > 1e4 ? t.reduce((e, t) => Math.min(e, t)) : Math.min(...t);
|
|
4709
4719
|
}
|
|
4710
4720
|
//#endregion
|
|
4711
4721
|
//#region src/functions/getMouseClientX.ts
|
|
4712
|
-
function
|
|
4722
|
+
function Bn(e) {
|
|
4713
4723
|
var t, n;
|
|
4714
4724
|
return (e == null ? void 0 : e.clientX) || (e == null || (t = e.targetTouches) == null || (t = t[0]) == null ? void 0 : t.clientX) || (e == null || (n = e.touches) == null || (n = n[0]) == null ? void 0 : n.clientX) || 0;
|
|
4715
4725
|
}
|
|
4716
4726
|
//#endregion
|
|
4717
4727
|
//#region src/functions/getMouseClientY.ts
|
|
4718
|
-
function
|
|
4728
|
+
function Vn(e) {
|
|
4719
4729
|
var t, n;
|
|
4720
4730
|
return (e == null ? void 0 : e.clientY) || (e == null || (t = e.targetTouches) == null || (t = t[0]) == null ? void 0 : t.clientY) || (e == null || (n = e.touches) == null || (n = n[0]) == null ? void 0 : n.clientY) || 0;
|
|
4721
4731
|
}
|
|
4722
4732
|
//#endregion
|
|
4723
4733
|
//#region src/functions/getMouseClient.ts
|
|
4724
|
-
function
|
|
4734
|
+
function Hn(e) {
|
|
4725
4735
|
return {
|
|
4726
|
-
x:
|
|
4727
|
-
y:
|
|
4736
|
+
x: Bn(e),
|
|
4737
|
+
y: Vn(e)
|
|
4728
4738
|
};
|
|
4729
4739
|
}
|
|
4730
4740
|
//#endregion
|
|
4731
4741
|
//#region src/functions/getObjectByKeys.ts
|
|
4732
|
-
function
|
|
4742
|
+
function Un(e, t) {
|
|
4733
4743
|
let r = {};
|
|
4734
4744
|
return n(e) && t.forEach((t) => {
|
|
4735
4745
|
t in e && e[t] !== void 0 && (r[t] = e[t]);
|
|
@@ -4737,7 +4747,7 @@ function Hn(e, t) {
|
|
|
4737
4747
|
}
|
|
4738
4748
|
//#endregion
|
|
4739
4749
|
//#region src/functions/getObjectNoUndefined.ts
|
|
4740
|
-
function
|
|
4750
|
+
function Wn(e, t = void 0) {
|
|
4741
4751
|
let n = {};
|
|
4742
4752
|
return r(e, (e, r) => {
|
|
4743
4753
|
e !== t && (n[r] = e);
|
|
@@ -4745,42 +4755,42 @@ function Un(e, t = void 0) {
|
|
|
4745
4755
|
}
|
|
4746
4756
|
//#endregion
|
|
4747
4757
|
//#region src/functions/getObjectOrNone.ts
|
|
4748
|
-
function
|
|
4758
|
+
function Gn(e) {
|
|
4749
4759
|
return n(e) ? e : {};
|
|
4750
4760
|
}
|
|
4751
4761
|
//#endregion
|
|
4752
4762
|
//#region src/functions/getOnlyText.ts
|
|
4753
|
-
function
|
|
4763
|
+
function Kn(e) {
|
|
4754
4764
|
return x(e).replace(/[^\p{L}\p{N}\s]+/gu, "").trim();
|
|
4755
4765
|
}
|
|
4756
4766
|
//#endregion
|
|
4757
4767
|
//#region src/functions/strFill.ts
|
|
4758
|
-
function
|
|
4768
|
+
function qn(e, t) {
|
|
4759
4769
|
return String(e).repeat(t);
|
|
4760
4770
|
}
|
|
4761
4771
|
//#endregion
|
|
4762
4772
|
//#region src/functions/getRandomText.ts
|
|
4763
|
-
function
|
|
4773
|
+
function Jn(e, t, n = "#", r = 2, i = 12) {
|
|
4764
4774
|
let a = f(e, t), o = [];
|
|
4765
|
-
for (let e = 0; e < a; e++) o.push(
|
|
4775
|
+
for (let e = 0; e < a; e++) o.push(qn(n, f(r, i)));
|
|
4766
4776
|
return o.join(" ");
|
|
4767
4777
|
}
|
|
4768
4778
|
//#endregion
|
|
4769
4779
|
//#region src/functions/getStepPercent.ts
|
|
4770
|
-
function
|
|
4780
|
+
function Yn(e, t) {
|
|
4771
4781
|
let n = e == null ? 0 : e;
|
|
4772
4782
|
return t > n ? 100 / (t - n) : 0;
|
|
4773
4783
|
}
|
|
4774
4784
|
//#endregion
|
|
4775
4785
|
//#region src/functions/getStepValue.ts
|
|
4776
|
-
function
|
|
4786
|
+
function Xn(e, t) {
|
|
4777
4787
|
let n = e == null ? 0 : e;
|
|
4778
4788
|
return t > n ? (t - n) / 100 : 0;
|
|
4779
4789
|
}
|
|
4780
4790
|
//#endregion
|
|
4781
4791
|
//#region src/functions/goScroll.ts
|
|
4782
|
-
var
|
|
4783
|
-
function
|
|
4792
|
+
var Zn = 0;
|
|
4793
|
+
function Qn(e, t, n) {
|
|
4784
4794
|
if (!s()) return;
|
|
4785
4795
|
let r = t == null ? void 0 : t.closest(e);
|
|
4786
4796
|
if (t && r && r.scrollHeight !== r.offsetHeight) {
|
|
@@ -4788,12 +4798,12 @@ function Zn(e, t, n) {
|
|
|
4788
4798
|
if (n) {
|
|
4789
4799
|
let a = n.getBoundingClientRect();
|
|
4790
4800
|
r.scrollTop = t.offsetTop - (a.top - e.top) - (a.height / 2 - i.height / 2), r.scrollTop + r.offsetHeight < t.offsetTop + t.offsetHeight && (r.scrollTop = t.offsetTop + t.offsetHeight - r.offsetHeight);
|
|
4791
|
-
} else r.scrollTop > t.offsetTop ? r.scrollTop = i.top - e.top -
|
|
4801
|
+
} else r.scrollTop > t.offsetTop ? r.scrollTop = i.top - e.top - Zn : r.scrollTop + r.offsetHeight < t.offsetTop + t.offsetHeight && (r.scrollTop = i.top - e.top + i.height - e.height + Zn);
|
|
4792
4802
|
}
|
|
4793
4803
|
}
|
|
4794
4804
|
//#endregion
|
|
4795
4805
|
//#region src/functions/goScrollSmooth.ts
|
|
4796
|
-
function
|
|
4806
|
+
function $n(e, t, n = 0) {
|
|
4797
4807
|
if (!s()) return;
|
|
4798
4808
|
let r = (t == null ? void 0 : t.behavior) || "smooth";
|
|
4799
4809
|
if ("scrollIntoView" in e && !n) {
|
|
@@ -4815,7 +4825,7 @@ function Qn(e, t, n = 0) {
|
|
|
4815
4825
|
}
|
|
4816
4826
|
//#endregion
|
|
4817
4827
|
//#region src/functions/goScrollTo.ts
|
|
4818
|
-
function
|
|
4828
|
+
function er(e, t, n = "smooth") {
|
|
4819
4829
|
if (!s() || !e || !t) return;
|
|
4820
4830
|
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect();
|
|
4821
4831
|
e.scrollBy({
|
|
@@ -4826,13 +4836,13 @@ function $n(e, t, n = "smooth") {
|
|
|
4826
4836
|
}
|
|
4827
4837
|
//#endregion
|
|
4828
4838
|
//#region src/functions/isShare.ts
|
|
4829
|
-
function
|
|
4839
|
+
function tr() {
|
|
4830
4840
|
return s() && typeof navigator < "u" && !!navigator.share;
|
|
4831
4841
|
}
|
|
4832
4842
|
//#endregion
|
|
4833
4843
|
//#region src/functions/handleShare.ts
|
|
4834
|
-
async function
|
|
4835
|
-
if (
|
|
4844
|
+
async function nr(e) {
|
|
4845
|
+
if (tr() && navigator.canShare && navigator.canShare(e)) try {
|
|
4836
4846
|
return await navigator.share(e), !0;
|
|
4837
4847
|
} catch (e) {
|
|
4838
4848
|
w.on({
|
|
@@ -4845,12 +4855,12 @@ async function tr(e) {
|
|
|
4845
4855
|
}
|
|
4846
4856
|
//#endregion
|
|
4847
4857
|
//#region src/functions/inArray.ts
|
|
4848
|
-
function
|
|
4858
|
+
function rr(e, t) {
|
|
4849
4859
|
return e.includes(t);
|
|
4850
4860
|
}
|
|
4851
4861
|
//#endregion
|
|
4852
4862
|
//#region src/functions/initScrollbarOffset.ts
|
|
4853
|
-
async function
|
|
4863
|
+
async function ir() {
|
|
4854
4864
|
if (s()) {
|
|
4855
4865
|
let e = await Lt.get();
|
|
4856
4866
|
document.body.style.setProperty("--sys-scrollbar-offset", `${e}px`);
|
|
@@ -4858,7 +4868,7 @@ async function rr() {
|
|
|
4858
4868
|
}
|
|
4859
4869
|
//#endregion
|
|
4860
4870
|
//#region src/functions/intersectKey.ts
|
|
4861
|
-
function
|
|
4871
|
+
function ar(e, n) {
|
|
4862
4872
|
let i = {};
|
|
4863
4873
|
return t(e) && t(n) && r(e, (e, t) => {
|
|
4864
4874
|
t in n && (i[t] = e);
|
|
@@ -4866,7 +4876,7 @@ function ir(e, n) {
|
|
|
4866
4876
|
}
|
|
4867
4877
|
//#endregion
|
|
4868
4878
|
//#region src/functions/isDifferent.ts
|
|
4869
|
-
function
|
|
4879
|
+
function or(e, t) {
|
|
4870
4880
|
let n = Object.keys(e).length !== Object.keys(t).length;
|
|
4871
4881
|
return n || r(e, (e, r) => {
|
|
4872
4882
|
e !== (t == null ? void 0 : t[r]) && (n = !0);
|
|
@@ -4874,7 +4884,7 @@ function ar(e, t) {
|
|
|
4874
4884
|
}
|
|
4875
4885
|
//#endregion
|
|
4876
4886
|
//#region src/functions/isElementVisible.ts
|
|
4877
|
-
function
|
|
4887
|
+
function sr(e) {
|
|
4878
4888
|
if (!s()) return !1;
|
|
4879
4889
|
let t = A(e);
|
|
4880
4890
|
if (!t || "isConnected" in t && t.isConnected === !1) return !1;
|
|
@@ -4883,16 +4893,16 @@ function or(e) {
|
|
|
4883
4893
|
}
|
|
4884
4894
|
//#endregion
|
|
4885
4895
|
//#region src/functions/isInput.ts
|
|
4886
|
-
var
|
|
4896
|
+
var cr = (e) => {
|
|
4887
4897
|
if (e instanceof HTMLElement) {
|
|
4888
4898
|
let t = e.tagName.toLowerCase();
|
|
4889
4899
|
return !!(t === "input" || t === "textarea" || t === "select" || e.isContentEditable || e.getAttribute("contenteditable") === "true") && !(e != null && e.readOnly) && !(e != null && e.disabled);
|
|
4890
4900
|
}
|
|
4891
4901
|
return !1;
|
|
4892
|
-
},
|
|
4902
|
+
}, lr = (e, t) => e.code === "Space" || e.code === "Enter" || e.key === " " || e.key === "Spacebar" || e.key === "Enter" || e.keyCode === 13 || e.keyCode === 32 ? t === void 0 ? !cr(e.target) : !t : !1;
|
|
4893
4903
|
//#endregion
|
|
4894
4904
|
//#region src/functions/isFloat.ts
|
|
4895
|
-
function
|
|
4905
|
+
function ur(e) {
|
|
4896
4906
|
switch (typeof e) {
|
|
4897
4907
|
case "number": return !0;
|
|
4898
4908
|
case "string": return /^-?\d+(\.\d+)?$/.test(e);
|
|
@@ -4901,24 +4911,24 @@ function lr(e) {
|
|
|
4901
4911
|
}
|
|
4902
4912
|
//#endregion
|
|
4903
4913
|
//#region src/functions/isIntegerBetween.ts
|
|
4904
|
-
function
|
|
4914
|
+
function dr(e, t) {
|
|
4905
4915
|
let n = Math.floor(t);
|
|
4906
4916
|
return e >= n && e < n + 1;
|
|
4907
4917
|
}
|
|
4908
4918
|
//#endregion
|
|
4909
4919
|
//#region src/functions/isMetaKey.ts
|
|
4910
|
-
var
|
|
4920
|
+
var fr = (e) => !!(e.metaKey || e.altKey || e.ctrlKey);
|
|
4911
4921
|
//#endregion
|
|
4912
4922
|
//#region src/functions/isSelectedByList.ts
|
|
4913
|
-
function
|
|
4923
|
+
function pr(e, t) {
|
|
4914
4924
|
return Array.isArray(e) ? e.every((e) => b(e, t)) : b(e, t);
|
|
4915
4925
|
}
|
|
4916
4926
|
//#endregion
|
|
4917
4927
|
//#region src/functions/isTab.ts
|
|
4918
|
-
var
|
|
4928
|
+
var mr = (e) => e.key === "Tab" || e.code === "Tab" || e.keyCode === 9;
|
|
4919
4929
|
//#endregion
|
|
4920
4930
|
//#region src/functions/removeCommonPrefix.ts
|
|
4921
|
-
function
|
|
4931
|
+
function hr(e, t) {
|
|
4922
4932
|
if (e.startsWith(t)) return e.slice(t.length).trim();
|
|
4923
4933
|
let n = 0;
|
|
4924
4934
|
for (; e[n] === t[n] && n < e.length && n < t.length;) n++;
|
|
@@ -4926,13 +4936,13 @@ function mr(e, t) {
|
|
|
4926
4936
|
}
|
|
4927
4937
|
//#endregion
|
|
4928
4938
|
//#region src/functions/replaceComponentName.ts
|
|
4929
|
-
var
|
|
4939
|
+
var gr = (e, t, n) => {
|
|
4930
4940
|
var r;
|
|
4931
4941
|
return e == null || (r = e.replace(RegExp(`<${t}`, "ig"), `<${n}`)) == null || (r = r.replace(RegExp(`</${t}`, "ig"), `</${n}`)) == null ? void 0 : r.trim();
|
|
4932
4942
|
};
|
|
4933
4943
|
//#endregion
|
|
4934
4944
|
//#region src/functions/uniqueArray.ts
|
|
4935
|
-
function
|
|
4945
|
+
function _r(e) {
|
|
4936
4946
|
return [...new Set(e)];
|
|
4937
4947
|
}
|
|
4938
4948
|
//#endregion
|
|
@@ -4941,12 +4951,12 @@ function $(e, n, i = !0) {
|
|
|
4941
4951
|
let a = Z(e);
|
|
4942
4952
|
return t(e) && t(n) && r(n, (n, r) => {
|
|
4943
4953
|
let o = e == null ? void 0 : e[r];
|
|
4944
|
-
t(o) && t(n) ? i && Array.isArray(o) && Array.isArray(n) ? a[r] = Z(
|
|
4954
|
+
t(o) && t(n) ? i && Array.isArray(o) && Array.isArray(n) ? a[r] = Z(_r([...o, ...n])) : a[r] = $(Array.isArray(o) ? { ...o } : o, n, i) : a[r] = t(n) ? Z(n) : n;
|
|
4945
4955
|
}), a;
|
|
4946
4956
|
}
|
|
4947
4957
|
//#endregion
|
|
4948
4958
|
//#region src/functions/replaceTemplate.ts
|
|
4949
|
-
function
|
|
4959
|
+
function vr(e, t) {
|
|
4950
4960
|
let n = e;
|
|
4951
4961
|
return r(t, (e, t) => {
|
|
4952
4962
|
n = n.replace(Gt(`[${t}]`), m(e));
|
|
@@ -4954,7 +4964,7 @@ function _r(e, t) {
|
|
|
4954
4964
|
}
|
|
4955
4965
|
//#endregion
|
|
4956
4966
|
//#region src/functions/secondToTime.ts
|
|
4957
|
-
function
|
|
4967
|
+
function yr(e, t) {
|
|
4958
4968
|
let n = y(e);
|
|
4959
4969
|
if (n > 0) {
|
|
4960
4970
|
let e = String(Math.floor(n / 60)).padStart(2, "0"), r = String(n % 60).padStart(2, "0");
|
|
@@ -4964,7 +4974,7 @@ function vr(e, t) {
|
|
|
4964
4974
|
}
|
|
4965
4975
|
//#endregion
|
|
4966
4976
|
//#region src/functions/setValues.ts
|
|
4967
|
-
function
|
|
4977
|
+
function br(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: a = !0, notEmpty: o = !1 }) {
|
|
4968
4978
|
if (n) {
|
|
4969
4979
|
if (i(e)) {
|
|
4970
4980
|
let n = e.indexOf(t), i = [...e];
|
|
@@ -4976,7 +4986,7 @@ function yr(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: a = !0, no
|
|
|
4976
4986
|
}
|
|
4977
4987
|
//#endregion
|
|
4978
4988
|
//#region src/functions/splice.ts
|
|
4979
|
-
function
|
|
4989
|
+
function xr(e, n, i) {
|
|
4980
4990
|
if (t(e) && t(n)) {
|
|
4981
4991
|
if (i) {
|
|
4982
4992
|
let a = {}, o = !1;
|
|
@@ -4990,34 +5000,34 @@ function br(e, n, i) {
|
|
|
4990
5000
|
}
|
|
4991
5001
|
//#endregion
|
|
4992
5002
|
//#region src/functions/toCamelCaseFirst.ts
|
|
4993
|
-
function
|
|
5003
|
+
function Sr(e) {
|
|
4994
5004
|
return ot(e).replace(/^([a-z])/, (e) => `${e.toUpperCase()}`);
|
|
4995
5005
|
}
|
|
4996
5006
|
//#endregion
|
|
4997
5007
|
//#region src/functions/toKebabCase.ts
|
|
4998
|
-
function
|
|
5008
|
+
function Cr(e) {
|
|
4999
5009
|
return e.toString().trim().replace(/[^\w-. ]+/g, "").replace(/[ .]+/g, "-").replace(/(?<=[A-Z])([A-Z])/g, (e) => `${e.toLowerCase()}`).replace(/^[A-Z]/, (e) => e.toLowerCase()).replace(/(?<=[\w ])[A-Z]/g, (e) => `-${e.toLowerCase()}`).replace(/[A-Z]/g, (e) => e.toLowerCase());
|
|
5000
5010
|
}
|
|
5001
5011
|
//#endregion
|
|
5002
5012
|
//#region src/functions/toNumberByMax.ts
|
|
5003
|
-
function
|
|
5013
|
+
function wr(e, t, n, r) {
|
|
5004
5014
|
let i = y(e), a = y(t);
|
|
5005
|
-
return t && a < i ? `${
|
|
5015
|
+
return t && a < i ? `${Tr(a, n, r)}+` : Tr(i, n, r);
|
|
5006
5016
|
}
|
|
5007
|
-
var
|
|
5017
|
+
var Tr = (e, t, n) => t ? new L(n).number(e) : e;
|
|
5008
5018
|
//#endregion
|
|
5009
5019
|
//#region src/functions/toPercent.ts
|
|
5010
|
-
function
|
|
5020
|
+
function Er(e, t) {
|
|
5011
5021
|
return e === 0 ? t : 1 / e * t;
|
|
5012
5022
|
}
|
|
5013
5023
|
//#endregion
|
|
5014
5024
|
//#region src/functions/toPercentBy100.ts
|
|
5015
|
-
function
|
|
5016
|
-
return
|
|
5025
|
+
function Dr(e, t) {
|
|
5026
|
+
return Er(e, t) * 100;
|
|
5017
5027
|
}
|
|
5018
5028
|
//#endregion
|
|
5019
5029
|
//#region src/functions/uint8ArrayToBase64.ts
|
|
5020
|
-
function
|
|
5030
|
+
function Or(e) {
|
|
5021
5031
|
let t = "";
|
|
5022
5032
|
for (let n of e) t += String.fromCharCode(n);
|
|
5023
5033
|
if (s()) return window.btoa(t);
|
|
@@ -5029,7 +5039,7 @@ function Dr(e) {
|
|
|
5029
5039
|
}
|
|
5030
5040
|
//#endregion
|
|
5031
5041
|
//#region src/functions/writeClipboardData.ts
|
|
5032
|
-
async function
|
|
5042
|
+
async function kr(e) {
|
|
5033
5043
|
if (s()) try {
|
|
5034
5044
|
await navigator.clipboard.writeText(e);
|
|
5035
5045
|
} catch (n) {
|
|
@@ -5038,4 +5048,4 @@ async function Or(e) {
|
|
|
5038
5048
|
}
|
|
5039
5049
|
}
|
|
5040
5050
|
//#endregion
|
|
5041
|
-
export { F as Api, N as ApiCache, Be as ApiDataReturn, Ve as ApiDefault, We as ApiError, He as ApiErrorItem, Ue as ApiErrorStorage, Ge as ApiHeaders, qe as ApiHydration, Qe as ApiInstance, P as ApiMethodItem, Je as ApiPreparation, Ze as ApiResponse, Re as ApiStatus, $e as BroadcastMessage, nt as Cache, tt as CacheItem, rt as CacheStatic, Ee as Cookie, Ce as CookieBlock, Se as CookieBlockInstance, O as CookieStorage, D as DataStorage, at as Datetime, w as ErrorCenter, ue as ErrorCenterHandler, de as ErrorCenterInstance, Ne as EventItem, st as Formatters, V as FormattersType, ct as GEO_FLAG_ICON_NAME, k as Geo, lt as GeoFlag, ke as GeoInstance, L as GeoIntl, ut as GeoPhone, ft as GeoUnit, pt as Global, gt as Hash, ht as HashInstance, yt as Icons, M as Loading, Fe as LoadingInstance, Mt as Meta, G as MetaManager, At as MetaOg, Dt as MetaOpenGraphAge, Tt as MetaOpenGraphAvailability, Et as MetaOpenGraphCondition, Ot as MetaOpenGraphGender, q as MetaOpenGraphTag, wt as MetaOpenGraphType, Ct as MetaRobots, Nt as MetaStatic, K as MetaTag, jt as MetaTwitter, kt as MetaTwitterCard, J as MetaTwitterTag, Ft as Query, Pt as QueryInstance, It as ResumableTimer, Lt as ScrollbarWidth, Xt as SearchList, Ut as SearchListData, Wt as SearchListItem, Jt as SearchListMatcher, Yt as SearchListOptions, E as ServerStorage, Qt as StorageCallback, rn as TRANSLATE_GLOBAL_PREFIX, an as TRANSLATE_TIME_OUT, cn as Translate, on as TranslateFile, sn as TranslateInstance, De as UI_GEO_COOKIE_KEY, mt as UrlInstanceAbstract, Y as UrlItem, Ht as addTagHighlightMatch, x as anyToString, tn as applyTemplate, ln as arrFill, mn as blobToBase64, hn as capitalize, Z as copyObject, gn as copyObjectLite, U as createElement, _n as domQuerySelector, vn as domQuerySelectorAll, W as encodeAttribute, me as encodeLiteAttribute, Sn as ensureMaxSize, X as escapeExp, Cn as eventStopPropagation, m as executeFunction, Ye as executePromise, r as forEach, wn as frame, Tn as getArrayHighlightMatch, En as getAttributes, Dn as getClipboardData, it as getColumn, On as getCurrentDate, kn as getCurrentTime, A as getElement, jn as getElementId, yn as getElementImage, bt as getElementItem, je as getElementOrWindow, he as getElementSafeScript, Kt as getExactSearchExp, Gt as getExp, Nn as getFirst, ge as getHydrationData, B as getItemByPath, Pn as getKey, Fn as
|
|
5051
|
+
export { F as Api, N as ApiCache, Be as ApiDataReturn, Ve as ApiDefault, We as ApiError, He as ApiErrorItem, Ue as ApiErrorStorage, Ge as ApiHeaders, qe as ApiHydration, Qe as ApiInstance, P as ApiMethodItem, Je as ApiPreparation, Ze as ApiResponse, Re as ApiStatus, $e as BroadcastMessage, nt as Cache, tt as CacheItem, rt as CacheStatic, Ee as Cookie, Ce as CookieBlock, Se as CookieBlockInstance, O as CookieStorage, D as DataStorage, at as Datetime, w as ErrorCenter, ue as ErrorCenterHandler, de as ErrorCenterInstance, Ne as EventItem, st as Formatters, V as FormattersType, ct as GEO_FLAG_ICON_NAME, k as Geo, lt as GeoFlag, ke as GeoInstance, L as GeoIntl, ut as GeoPhone, ft as GeoUnit, pt as Global, gt as Hash, ht as HashInstance, yt as Icons, M as Loading, Fe as LoadingInstance, Mt as Meta, G as MetaManager, At as MetaOg, Dt as MetaOpenGraphAge, Tt as MetaOpenGraphAvailability, Et as MetaOpenGraphCondition, Ot as MetaOpenGraphGender, q as MetaOpenGraphTag, wt as MetaOpenGraphType, Ct as MetaRobots, Nt as MetaStatic, K as MetaTag, jt as MetaTwitter, kt as MetaTwitterCard, J as MetaTwitterTag, Ft as Query, Pt as QueryInstance, It as ResumableTimer, Lt as ScrollbarWidth, Xt as SearchList, Ut as SearchListData, Wt as SearchListItem, Jt as SearchListMatcher, Yt as SearchListOptions, E as ServerStorage, Qt as StorageCallback, rn as TRANSLATE_GLOBAL_PREFIX, an as TRANSLATE_TIME_OUT, cn as Translate, on as TranslateFile, sn as TranslateInstance, De as UI_GEO_COOKIE_KEY, mt as UrlInstanceAbstract, Y as UrlItem, Ht as addTagHighlightMatch, x as anyToString, tn as applyTemplate, ln as arrFill, mn as blobToBase64, hn as capitalize, Z as copyObject, gn as copyObjectLite, U as createElement, _n as domQuerySelector, vn as domQuerySelectorAll, W as encodeAttribute, me as encodeLiteAttribute, Sn as ensureMaxSize, X as escapeExp, Cn as eventStopPropagation, m as executeFunction, Ye as executePromise, r as forEach, wn as frame, Tn as getArrayHighlightMatch, En as getAttributes, Dn as getClipboardData, it as getColumn, On as getCurrentDate, kn as getCurrentTime, A as getElement, jn as getElementId, yn as getElementImage, bt as getElementItem, je as getElementOrWindow, he as getElementSafeScript, Kt as getExactSearchExp, Gt as getExp, Nn as getFirst, ge as getHydrationData, B as getItemByPath, Pn as getKey, Fn as getLast, In as getLength, Ln as getLengthOfAllArray, Rn as getMaxLengthAllArray, zn as getMinLengthAllArray, Hn as getMouseClient, Bn as getMouseClientX, Vn as getMouseClientY, Un as getObjectByKeys, Wn as getObjectNoUndefined, Gn as getObjectOrNone, Kn as getOnlyText, Jn as getRandomText, o as getRequestString, qt as getSearchExp, Rt as getSeparatingSearchExp, Yn as getStepPercent, Xn as getStepValue, Qn as goScroll, $n as goScrollSmooth, er as goScrollTo, nr as handleShare, rr as inArray, Mn as initGetElementId, ir as initScrollbarOffset, ar as intersectKey, nn as isApiSuccess, i as isArray, or as isDifferent, oe as isDomData, s as isDomRuntime, sr as isElementVisible, lr as isEnter, l as isFilled, ur as isFloat, p as isFunction, Me as isInDom, cr as isInput, dr as isIntegerBetween, fr as isMetaKey, c as isNull, h as isNumber, t as isObject, n as isObjectNotArray, u as isOnLine, b as isSelected, pr as isSelectedByList, tr as isShare, d as isString, mr as isTab, Ae as isWindow, f as random, hr as removeCommonPrefix, gr as replaceComponentName, $ as replaceRecursive, vr as replaceTemplate, xn as resizeImageByMax, yr as secondToTime, xt as setElementItem, br as setValues, ee as sleep, xr as splice, qn as strFill, se as strSplit, j as toArray, ot as toCamelCase, Sr as toCamelCaseFirst, I as toDate, Cr as toKebabCase, y as toNumber, wr as toNumberByMax, Er as toPercent, Dr as toPercentBy100, a as toString, T as transformation, Or as uint8ArrayToBase64, _r as uniqueArray, kr as writeClipboardData };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxtmisha/functional-basic",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.7.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Foundational utility library for modern web development — HTTP client, geolocation, i18n, SEO meta tags, caching, storage, DOM utilities, and more. Framework-agnostic, zero dependencies, TypeScript-first.",
|
|
7
7
|
"keywords": [
|