@dxtmisha/functional-basic 1.1.9 → 1.2.0
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 +10 -0
- package/dist/library.js +67 -57
- package/dist/src/functions/getFirst.d.ts +8 -0
- package/dist/src/library.d.ts +1 -0
- package/package.json +2 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [1.2.0] - 2026-05-14
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- **Functions**: Added `getFirst` utility function to safely retrieve the first element from arrays or objects, providing consistent behavior for various data structures with full TypeScript support.
|
|
9
|
+
|
|
10
|
+
### Changed / Improved
|
|
11
|
+
- **Dependencies**: Integrated `@dxtmisha/media` into `peerDependencies` to ensure better compatibility with media-related utilities.
|
|
12
|
+
- **Build System**: Optimized the build configuration by simplifying export maps and standardizing type definition paths within the distribution.
|
|
13
|
+
- **Maintenance**: Standardized internal scripts and performed general cleanup of obsolete type definitions and exported files.
|
|
14
|
+
|
|
5
15
|
## [1.1.8] - 2026-05-12
|
|
6
16
|
|
|
7
17
|
### Added
|
package/dist/library.js
CHANGED
|
@@ -4249,14 +4249,24 @@ function xn(e) {
|
|
|
4249
4249
|
Q || (Q = e);
|
|
4250
4250
|
}
|
|
4251
4251
|
//#endregion
|
|
4252
|
-
//#region src/functions/
|
|
4252
|
+
//#region src/functions/getFirst.ts
|
|
4253
4253
|
function Sn(e) {
|
|
4254
|
+
if (i(e)) return e == null ? void 0 : e[0];
|
|
4255
|
+
if (t(e)) {
|
|
4256
|
+
var n;
|
|
4257
|
+
return (n = Object.values(e)) == null ? void 0 : n[0];
|
|
4258
|
+
}
|
|
4259
|
+
return e;
|
|
4260
|
+
}
|
|
4261
|
+
//#endregion
|
|
4262
|
+
//#region src/functions/getKey.ts
|
|
4263
|
+
function Cn(e) {
|
|
4254
4264
|
var t, n, r;
|
|
4255
4265
|
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;
|
|
4256
4266
|
}
|
|
4257
4267
|
//#endregion
|
|
4258
4268
|
//#region src/functions/getLengthOfAllArray.ts
|
|
4259
|
-
function
|
|
4269
|
+
function wn(e) {
|
|
4260
4270
|
return r(e, (e) => {
|
|
4261
4271
|
var t;
|
|
4262
4272
|
return (t = e == null ? void 0 : e.length) == null ? 0 : t;
|
|
@@ -4264,41 +4274,41 @@ function Cn(e) {
|
|
|
4264
4274
|
}
|
|
4265
4275
|
//#endregion
|
|
4266
4276
|
//#region src/functions/getMaxLengthAllArray.ts
|
|
4267
|
-
function
|
|
4277
|
+
function Tn(e) {
|
|
4268
4278
|
if (!l(e)) return 0;
|
|
4269
|
-
let t =
|
|
4279
|
+
let t = wn(e);
|
|
4270
4280
|
return t.length > 1e4 ? t.reduce((e, t) => Math.max(e, t)) : Math.max(...t);
|
|
4271
4281
|
}
|
|
4272
4282
|
//#endregion
|
|
4273
4283
|
//#region src/functions/getMinLengthAllArray.ts
|
|
4274
|
-
function
|
|
4284
|
+
function En(e) {
|
|
4275
4285
|
if (!l(e)) return 0;
|
|
4276
|
-
let t =
|
|
4286
|
+
let t = wn(e);
|
|
4277
4287
|
return t.length > 1e4 ? t.reduce((e, t) => Math.min(e, t)) : Math.min(...t);
|
|
4278
4288
|
}
|
|
4279
4289
|
//#endregion
|
|
4280
4290
|
//#region src/functions/getMouseClientX.ts
|
|
4281
|
-
function
|
|
4291
|
+
function Dn(e) {
|
|
4282
4292
|
var t, n;
|
|
4283
4293
|
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;
|
|
4284
4294
|
}
|
|
4285
4295
|
//#endregion
|
|
4286
4296
|
//#region src/functions/getMouseClientY.ts
|
|
4287
|
-
function
|
|
4297
|
+
function On(e) {
|
|
4288
4298
|
var t, n;
|
|
4289
4299
|
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;
|
|
4290
4300
|
}
|
|
4291
4301
|
//#endregion
|
|
4292
4302
|
//#region src/functions/getMouseClient.ts
|
|
4293
|
-
function
|
|
4303
|
+
function kn(e) {
|
|
4294
4304
|
return {
|
|
4295
|
-
x:
|
|
4296
|
-
y:
|
|
4305
|
+
x: Dn(e),
|
|
4306
|
+
y: On(e)
|
|
4297
4307
|
};
|
|
4298
4308
|
}
|
|
4299
4309
|
//#endregion
|
|
4300
4310
|
//#region src/functions/getObjectByKeys.ts
|
|
4301
|
-
function
|
|
4311
|
+
function An(e, t) {
|
|
4302
4312
|
let r = {};
|
|
4303
4313
|
return n(e) && t.forEach((t) => {
|
|
4304
4314
|
t in e && e[t] !== void 0 && (r[t] = e[t]);
|
|
@@ -4306,7 +4316,7 @@ function kn(e, t) {
|
|
|
4306
4316
|
}
|
|
4307
4317
|
//#endregion
|
|
4308
4318
|
//#region src/functions/getObjectNoUndefined.ts
|
|
4309
|
-
function
|
|
4319
|
+
function jn(e, t = void 0) {
|
|
4310
4320
|
let n = {};
|
|
4311
4321
|
return r(e, (e, r) => {
|
|
4312
4322
|
e !== t && (n[r] = e);
|
|
@@ -4314,42 +4324,42 @@ function An(e, t = void 0) {
|
|
|
4314
4324
|
}
|
|
4315
4325
|
//#endregion
|
|
4316
4326
|
//#region src/functions/getObjectOrNone.ts
|
|
4317
|
-
function
|
|
4327
|
+
function Mn(e) {
|
|
4318
4328
|
return n(e) ? e : {};
|
|
4319
4329
|
}
|
|
4320
4330
|
//#endregion
|
|
4321
4331
|
//#region src/functions/getOnlyText.ts
|
|
4322
|
-
function
|
|
4332
|
+
function Nn(e) {
|
|
4323
4333
|
return F(e).replace(/[^\p{L}\p{N}\s]+/gu, "").trim();
|
|
4324
4334
|
}
|
|
4325
4335
|
//#endregion
|
|
4326
4336
|
//#region src/functions/strFill.ts
|
|
4327
|
-
function
|
|
4337
|
+
function Pn(e, t) {
|
|
4328
4338
|
return String(e).repeat(t);
|
|
4329
4339
|
}
|
|
4330
4340
|
//#endregion
|
|
4331
4341
|
//#region src/functions/getRandomText.ts
|
|
4332
|
-
function
|
|
4342
|
+
function Fn(e, t, n = "#", r = 2, i = 12) {
|
|
4333
4343
|
let a = f(e, t), o = [];
|
|
4334
|
-
for (let e = 0; e < a; e++) o.push(
|
|
4344
|
+
for (let e = 0; e < a; e++) o.push(Pn(n, f(r, i)));
|
|
4335
4345
|
return o.join(" ");
|
|
4336
4346
|
}
|
|
4337
4347
|
//#endregion
|
|
4338
4348
|
//#region src/functions/getStepPercent.ts
|
|
4339
|
-
function
|
|
4349
|
+
function In(e, t) {
|
|
4340
4350
|
let n = e == null ? 0 : e;
|
|
4341
4351
|
return t > n ? 100 / (t - n) : 0;
|
|
4342
4352
|
}
|
|
4343
4353
|
//#endregion
|
|
4344
4354
|
//#region src/functions/getStepValue.ts
|
|
4345
|
-
function
|
|
4355
|
+
function Ln(e, t) {
|
|
4346
4356
|
let n = e == null ? 0 : e;
|
|
4347
4357
|
return t > n ? (t - n) / 100 : 0;
|
|
4348
4358
|
}
|
|
4349
4359
|
//#endregion
|
|
4350
4360
|
//#region src/functions/goScroll.ts
|
|
4351
|
-
var
|
|
4352
|
-
function
|
|
4361
|
+
var Rn = 0;
|
|
4362
|
+
function zn(e, t, n) {
|
|
4353
4363
|
if (!s()) return;
|
|
4354
4364
|
let r = t == null ? void 0 : t.closest(e);
|
|
4355
4365
|
if (t && r && r.scrollHeight !== r.offsetHeight) {
|
|
@@ -4357,12 +4367,12 @@ function Rn(e, t, n) {
|
|
|
4357
4367
|
if (n) {
|
|
4358
4368
|
let a = n.getBoundingClientRect();
|
|
4359
4369
|
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);
|
|
4360
|
-
} else r.scrollTop > t.offsetTop ? r.scrollTop = i.top - e.top -
|
|
4370
|
+
} else r.scrollTop > t.offsetTop ? r.scrollTop = i.top - e.top - Rn : r.scrollTop + r.offsetHeight < t.offsetTop + t.offsetHeight && (r.scrollTop = i.top - e.top + i.height - e.height + Rn);
|
|
4361
4371
|
}
|
|
4362
4372
|
}
|
|
4363
4373
|
//#endregion
|
|
4364
4374
|
//#region src/functions/goScrollSmooth.ts
|
|
4365
|
-
function
|
|
4375
|
+
function Bn(e, t, n = 0) {
|
|
4366
4376
|
if (!s()) return;
|
|
4367
4377
|
let r = (t == null ? void 0 : t.behavior) || "smooth";
|
|
4368
4378
|
if ("scrollIntoView" in e && !n) {
|
|
@@ -4384,7 +4394,7 @@ function zn(e, t, n = 0) {
|
|
|
4384
4394
|
}
|
|
4385
4395
|
//#endregion
|
|
4386
4396
|
//#region src/functions/goScrollTo.ts
|
|
4387
|
-
function
|
|
4397
|
+
function Vn(e, t, n = "smooth") {
|
|
4388
4398
|
if (!s() || !e || !t) return;
|
|
4389
4399
|
let r = e.getBoundingClientRect(), i = t.getBoundingClientRect();
|
|
4390
4400
|
e.scrollBy({
|
|
@@ -4395,13 +4405,13 @@ function Bn(e, t, n = "smooth") {
|
|
|
4395
4405
|
}
|
|
4396
4406
|
//#endregion
|
|
4397
4407
|
//#region src/functions/isShare.ts
|
|
4398
|
-
function
|
|
4408
|
+
function Hn() {
|
|
4399
4409
|
return s() && typeof navigator < "u" && !!navigator.share;
|
|
4400
4410
|
}
|
|
4401
4411
|
//#endregion
|
|
4402
4412
|
//#region src/functions/handleShare.ts
|
|
4403
|
-
async function
|
|
4404
|
-
if (
|
|
4413
|
+
async function Un(e) {
|
|
4414
|
+
if (Hn() && navigator.canShare && navigator.canShare(e)) try {
|
|
4405
4415
|
return await navigator.share(e), !0;
|
|
4406
4416
|
} catch (e) {
|
|
4407
4417
|
w.on({
|
|
@@ -4414,12 +4424,12 @@ async function Hn(e) {
|
|
|
4414
4424
|
}
|
|
4415
4425
|
//#endregion
|
|
4416
4426
|
//#region src/functions/inArray.ts
|
|
4417
|
-
function
|
|
4427
|
+
function Wn(e, t) {
|
|
4418
4428
|
return e.includes(t);
|
|
4419
4429
|
}
|
|
4420
4430
|
//#endregion
|
|
4421
4431
|
//#region src/functions/initScrollbarOffset.ts
|
|
4422
|
-
async function
|
|
4432
|
+
async function Gn() {
|
|
4423
4433
|
if (s()) {
|
|
4424
4434
|
let e = await Et.get();
|
|
4425
4435
|
document.body.style.setProperty("--sys-scrollbar-offset", `${e}px`);
|
|
@@ -4427,7 +4437,7 @@ async function Wn() {
|
|
|
4427
4437
|
}
|
|
4428
4438
|
//#endregion
|
|
4429
4439
|
//#region src/functions/intersectKey.ts
|
|
4430
|
-
function
|
|
4440
|
+
function Kn(e, n) {
|
|
4431
4441
|
let i = {};
|
|
4432
4442
|
return t(e) && t(n) && r(e, (e, t) => {
|
|
4433
4443
|
t in n && (i[t] = e);
|
|
@@ -4435,7 +4445,7 @@ function Gn(e, n) {
|
|
|
4435
4445
|
}
|
|
4436
4446
|
//#endregion
|
|
4437
4447
|
//#region src/functions/isDifferent.ts
|
|
4438
|
-
function
|
|
4448
|
+
function qn(e, t) {
|
|
4439
4449
|
let n = Object.keys(e).length !== Object.keys(t).length;
|
|
4440
4450
|
return n || r(e, (e, r) => {
|
|
4441
4451
|
e !== (t == null ? void 0 : t[r]) && (n = !0);
|
|
@@ -4443,7 +4453,7 @@ function Kn(e, t) {
|
|
|
4443
4453
|
}
|
|
4444
4454
|
//#endregion
|
|
4445
4455
|
//#region src/functions/isElementVisible.ts
|
|
4446
|
-
function
|
|
4456
|
+
function Jn(e) {
|
|
4447
4457
|
if (!s()) return !1;
|
|
4448
4458
|
let t = k(e);
|
|
4449
4459
|
if (!t || "isConnected" in t && t.isConnected === !1) return !1;
|
|
@@ -4452,16 +4462,16 @@ function qn(e) {
|
|
|
4452
4462
|
}
|
|
4453
4463
|
//#endregion
|
|
4454
4464
|
//#region src/functions/isInput.ts
|
|
4455
|
-
var
|
|
4465
|
+
var Yn = (e) => {
|
|
4456
4466
|
if (e instanceof HTMLElement) {
|
|
4457
4467
|
let t = e.tagName.toLowerCase();
|
|
4458
4468
|
return !!(t === "input" || t === "textarea" || t === "select" || e.isContentEditable || e.getAttribute("contenteditable") === "true");
|
|
4459
4469
|
}
|
|
4460
4470
|
return !1;
|
|
4461
|
-
},
|
|
4471
|
+
}, Xn = (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 ? !Yn(e.target) : !t : !1;
|
|
4462
4472
|
//#endregion
|
|
4463
4473
|
//#region src/functions/isFloat.ts
|
|
4464
|
-
function
|
|
4474
|
+
function Zn(e) {
|
|
4465
4475
|
switch (typeof e) {
|
|
4466
4476
|
case "number": return !0;
|
|
4467
4477
|
case "string": return /^-?\d+(\.\d+)?$/.test(e);
|
|
@@ -4470,18 +4480,18 @@ function Xn(e) {
|
|
|
4470
4480
|
}
|
|
4471
4481
|
//#endregion
|
|
4472
4482
|
//#region src/functions/isIntegerBetween.ts
|
|
4473
|
-
function
|
|
4483
|
+
function Qn(e, t) {
|
|
4474
4484
|
let n = Math.floor(t);
|
|
4475
4485
|
return e >= n && e < n + 1;
|
|
4476
4486
|
}
|
|
4477
4487
|
//#endregion
|
|
4478
4488
|
//#region src/functions/isSelectedByList.ts
|
|
4479
|
-
function
|
|
4489
|
+
function $n(e, t) {
|
|
4480
4490
|
return Array.isArray(e) ? e.every((e) => y(e, t)) : y(e, t);
|
|
4481
4491
|
}
|
|
4482
4492
|
//#endregion
|
|
4483
4493
|
//#region src/functions/removeCommonPrefix.ts
|
|
4484
|
-
function
|
|
4494
|
+
function er(e, t) {
|
|
4485
4495
|
if (e.startsWith(t)) return e.slice(t.length).trim();
|
|
4486
4496
|
let n = 0;
|
|
4487
4497
|
for (; e[n] === t[n] && n < e.length && n < t.length;) n++;
|
|
@@ -4489,13 +4499,13 @@ function $n(e, t) {
|
|
|
4489
4499
|
}
|
|
4490
4500
|
//#endregion
|
|
4491
4501
|
//#region src/functions/replaceComponentName.ts
|
|
4492
|
-
var
|
|
4502
|
+
var tr = (e, t, n) => {
|
|
4493
4503
|
var r;
|
|
4494
4504
|
return e == null || (r = e.replace(RegExp(`<${t}`, "ig"), `<${n}`)) == null || (r = r.replace(RegExp(`</${t}`, "ig"), `</${n}`)) == null ? void 0 : r.trim();
|
|
4495
4505
|
};
|
|
4496
4506
|
//#endregion
|
|
4497
4507
|
//#region src/functions/uniqueArray.ts
|
|
4498
|
-
function
|
|
4508
|
+
function nr(e) {
|
|
4499
4509
|
return [...new Set(e)];
|
|
4500
4510
|
}
|
|
4501
4511
|
//#endregion
|
|
@@ -4504,12 +4514,12 @@ function $(e, n, i = !0) {
|
|
|
4504
4514
|
let a = Z(e);
|
|
4505
4515
|
return t(e) && t(n) && r(n, (n, r) => {
|
|
4506
4516
|
let o = e == null ? void 0 : e[r];
|
|
4507
|
-
t(o) && t(n) ? i && Array.isArray(o) && Array.isArray(n) ? a[r] = Z(
|
|
4517
|
+
t(o) && t(n) ? i && Array.isArray(o) && Array.isArray(n) ? a[r] = Z(nr([...o, ...n])) : a[r] = $(Array.isArray(o) ? { ...o } : o, n, i) : a[r] = t(n) ? Z(n) : n;
|
|
4508
4518
|
}), a;
|
|
4509
4519
|
}
|
|
4510
4520
|
//#endregion
|
|
4511
4521
|
//#region src/functions/replaceTemplate.ts
|
|
4512
|
-
function
|
|
4522
|
+
function rr(e, t) {
|
|
4513
4523
|
let n = e;
|
|
4514
4524
|
return r(t, (e, t) => {
|
|
4515
4525
|
n = n.replace(Pt(`[${t}]`), x(e));
|
|
@@ -4517,7 +4527,7 @@ function nr(e, t) {
|
|
|
4517
4527
|
}
|
|
4518
4528
|
//#endregion
|
|
4519
4529
|
//#region src/functions/secondToTime.ts
|
|
4520
|
-
function
|
|
4530
|
+
function ir(e, t) {
|
|
4521
4531
|
let n = v(e);
|
|
4522
4532
|
if (n > 0) {
|
|
4523
4533
|
let e = String(Math.floor(n / 60)).padStart(2, "0"), r = String(n % 60).padStart(2, "0");
|
|
@@ -4527,7 +4537,7 @@ function rr(e, t) {
|
|
|
4527
4537
|
}
|
|
4528
4538
|
//#endregion
|
|
4529
4539
|
//#region src/functions/setValues.ts
|
|
4530
|
-
function
|
|
4540
|
+
function ar(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: a = !0, notEmpty: o = !1 }) {
|
|
4531
4541
|
if (n) {
|
|
4532
4542
|
if (i(e)) {
|
|
4533
4543
|
let n = e.indexOf(t), i = [...e];
|
|
@@ -4539,7 +4549,7 @@ function ir(e, t, { multiple: n = !1, maxlength: r = 0, alwaysChange: a = !0, no
|
|
|
4539
4549
|
}
|
|
4540
4550
|
//#endregion
|
|
4541
4551
|
//#region src/functions/splice.ts
|
|
4542
|
-
function
|
|
4552
|
+
function or(e, n, i) {
|
|
4543
4553
|
if (t(e) && t(n)) {
|
|
4544
4554
|
if (i) {
|
|
4545
4555
|
let a = {}, o = !1;
|
|
@@ -4553,34 +4563,34 @@ function ar(e, n, i) {
|
|
|
4553
4563
|
}
|
|
4554
4564
|
//#endregion
|
|
4555
4565
|
//#region src/functions/toCamelCaseFirst.ts
|
|
4556
|
-
function
|
|
4566
|
+
function sr(e) {
|
|
4557
4567
|
return H(e).replace(/^([a-z])/, (e) => `${e.toUpperCase()}`);
|
|
4558
4568
|
}
|
|
4559
4569
|
//#endregion
|
|
4560
4570
|
//#region src/functions/toKebabCase.ts
|
|
4561
|
-
function
|
|
4571
|
+
function cr(e) {
|
|
4562
4572
|
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());
|
|
4563
4573
|
}
|
|
4564
4574
|
//#endregion
|
|
4565
4575
|
//#region src/functions/toNumberByMax.ts
|
|
4566
|
-
function
|
|
4576
|
+
function lr(e, t, n, r) {
|
|
4567
4577
|
let i = v(e), a = v(t);
|
|
4568
|
-
return t && a < i ? `${
|
|
4578
|
+
return t && a < i ? `${ur(a, n, r)}+` : ur(i, n, r);
|
|
4569
4579
|
}
|
|
4570
|
-
var
|
|
4580
|
+
var ur = (e, t, n) => t ? new R(n).number(e) : e;
|
|
4571
4581
|
//#endregion
|
|
4572
4582
|
//#region src/functions/toPercent.ts
|
|
4573
|
-
function
|
|
4583
|
+
function dr(e, t) {
|
|
4574
4584
|
return e === 0 ? t : 1 / e * t;
|
|
4575
4585
|
}
|
|
4576
4586
|
//#endregion
|
|
4577
4587
|
//#region src/functions/toPercentBy100.ts
|
|
4578
|
-
function
|
|
4579
|
-
return
|
|
4588
|
+
function fr(e, t) {
|
|
4589
|
+
return dr(e, t) * 100;
|
|
4580
4590
|
}
|
|
4581
4591
|
//#endregion
|
|
4582
4592
|
//#region src/functions/uint8ArrayToBase64.ts
|
|
4583
|
-
function
|
|
4593
|
+
function pr(e) {
|
|
4584
4594
|
let t = "";
|
|
4585
4595
|
for (let n of e) t += String.fromCharCode(n);
|
|
4586
4596
|
if (s()) return window.btoa(t);
|
|
@@ -4592,7 +4602,7 @@ function fr(e) {
|
|
|
4592
4602
|
}
|
|
4593
4603
|
//#endregion
|
|
4594
4604
|
//#region src/functions/writeClipboardData.ts
|
|
4595
|
-
async function
|
|
4605
|
+
async function mr(e) {
|
|
4596
4606
|
if (s()) try {
|
|
4597
4607
|
await navigator.clipboard.writeText(e);
|
|
4598
4608
|
} catch (n) {
|
|
@@ -4601,4 +4611,4 @@ async function pr(e) {
|
|
|
4601
4611
|
}
|
|
4602
4612
|
}
|
|
4603
4613
|
//#endregion
|
|
4604
|
-
export { P as Api, M as ApiCache, Ae as ApiDataReturn, je as ApiDefault, Me as ApiHeaders, Pe as ApiHydration, ze as ApiInstance, N as ApiMethodItem, Fe as ApiPreparation, Re as ApiResponse, Oe as ApiStatus, Be as BroadcastMessage, Ue as Cache, He as CacheItem, We as CacheStatic, Qe as Cookie, Ye as CookieBlock, Je as CookieBlockInstance, I as CookieStorage, E as DataStorage, et as Datetime, w as ErrorCenter, ue as ErrorCenterHandler, de as ErrorCenterInstance, Ce as EventItem, tt as Formatters, U as FormattersType, nt as GEO_FLAG_ICON_NAME, D as Geo, rt as GeoFlag, be as GeoInstance, R as GeoIntl, it as GeoPhone, at as Global, st as Hash, ot as HashInstance, ut as Icons, j as Loading, Te as LoadingInstance, Ct as Meta, K as MetaManager, xt as MetaOg, vt as MetaOpenGraphAge, gt as MetaOpenGraphAvailability, _t as MetaOpenGraphCondition, yt as MetaOpenGraphGender, J as MetaOpenGraphTag, ht as MetaOpenGraphType, mt as MetaRobots, wt as MetaStatic, q as MetaTag, St as MetaTwitter, bt as MetaTwitterCard, Y as MetaTwitterTag, Tt as ResumableTimer, Et as ScrollbarWidth, zt as SearchList, Mt as SearchListData, Nt as SearchListItem, Lt as SearchListMatcher, Rt as SearchListOptions, T as ServerStorage, Vt as StorageCallback, Kt as TRANSLATE_GLOBAL_PREFIX, qt as TRANSLATE_TIME_OUT, Xt as Translate, Jt as TranslateFile, Yt as TranslateInstance, jt as addTagHighlightMatch, F as anyToString, Wt as applyTemplate, Zt as arrFill, nn as blobToBase64, rn as capitalize, Z as copyObject, an as copyObjectLite, W as createElement, on as domQuerySelector, sn as domQuerySelectorAll, G as encodeAttribute, oe as encodeLiteAttribute, dn as ensureMaxSize, X as escapeExp, fn as eventStopPropagation, x as executeFunction, Ie as executePromise, r as forEach, pn as frame, mn as getArrayHighlightMatch, hn as getAttributes, gn as getClipboardData, $e as getColumn, _n as getCurrentDate, vn as getCurrentTime, k as getElement, bn as getElementId, cn as getElementImage, dt as getElementItem, xe as getElementOrWindow, pe as getElementSafeScript, Ft as getExactSearchExp, Pt as getExp, me as getHydrationData, V as getItemByPath,
|
|
4614
|
+
export { P as Api, M as ApiCache, Ae as ApiDataReturn, je as ApiDefault, Me as ApiHeaders, Pe as ApiHydration, ze as ApiInstance, N as ApiMethodItem, Fe as ApiPreparation, Re as ApiResponse, Oe as ApiStatus, Be as BroadcastMessage, Ue as Cache, He as CacheItem, We as CacheStatic, Qe as Cookie, Ye as CookieBlock, Je as CookieBlockInstance, I as CookieStorage, E as DataStorage, et as Datetime, w as ErrorCenter, ue as ErrorCenterHandler, de as ErrorCenterInstance, Ce as EventItem, tt as Formatters, U as FormattersType, nt as GEO_FLAG_ICON_NAME, D as Geo, rt as GeoFlag, be as GeoInstance, R as GeoIntl, it as GeoPhone, at as Global, st as Hash, ot as HashInstance, ut as Icons, j as Loading, Te as LoadingInstance, Ct as Meta, K as MetaManager, xt as MetaOg, vt as MetaOpenGraphAge, gt as MetaOpenGraphAvailability, _t as MetaOpenGraphCondition, yt as MetaOpenGraphGender, J as MetaOpenGraphTag, ht as MetaOpenGraphType, mt as MetaRobots, wt as MetaStatic, q as MetaTag, St as MetaTwitter, bt as MetaTwitterCard, Y as MetaTwitterTag, Tt as ResumableTimer, Et as ScrollbarWidth, zt as SearchList, Mt as SearchListData, Nt as SearchListItem, Lt as SearchListMatcher, Rt as SearchListOptions, T as ServerStorage, Vt as StorageCallback, Kt as TRANSLATE_GLOBAL_PREFIX, qt as TRANSLATE_TIME_OUT, Xt as Translate, Jt as TranslateFile, Yt as TranslateInstance, jt as addTagHighlightMatch, F as anyToString, Wt as applyTemplate, Zt as arrFill, nn as blobToBase64, rn as capitalize, Z as copyObject, an as copyObjectLite, W as createElement, on as domQuerySelector, sn as domQuerySelectorAll, G as encodeAttribute, oe as encodeLiteAttribute, dn as ensureMaxSize, X as escapeExp, fn as eventStopPropagation, x as executeFunction, Ie as executePromise, r as forEach, pn as frame, mn as getArrayHighlightMatch, hn as getAttributes, gn as getClipboardData, $e as getColumn, _n as getCurrentDate, vn as getCurrentTime, k as getElement, bn as getElementId, cn as getElementImage, dt as getElementItem, xe as getElementOrWindow, pe as getElementSafeScript, Ft as getExactSearchExp, Pt as getExp, Sn as getFirst, me as getHydrationData, V as getItemByPath, Cn as getKey, wn as getLengthOfAllArray, Tn as getMaxLengthAllArray, En as getMinLengthAllArray, kn as getMouseClient, Dn as getMouseClientX, On as getMouseClientY, An as getObjectByKeys, jn as getObjectNoUndefined, Mn as getObjectOrNone, Nn as getOnlyText, Fn as getRandomText, o as getRequestString, It as getSearchExp, Dt as getSeparatingSearchExp, In as getStepPercent, Ln as getStepValue, zn as goScroll, Bn as goScrollSmooth, Vn as goScrollTo, Un as handleShare, Wn as inArray, xn as initGetElementId, Gn as initScrollbarOffset, Kn as intersectKey, Gt as isApiSuccess, i as isArray, qn as isDifferent, se as isDomData, s as isDomRuntime, Jn as isElementVisible, Xn as isEnter, l as isFilled, Zn as isFloat, b as isFunction, Se as isInDom, Yn as isInput, Qn as isIntegerBetween, c as isNull, m as isNumber, t as isObject, n as isObjectNotArray, u as isOnLine, y as isSelected, $n as isSelectedByList, Hn as isShare, d as isString, O as isWindow, f as random, er as removeCommonPrefix, tr as replaceComponentName, $ as replaceRecursive, rr as replaceTemplate, un as resizeImageByMax, ir as secondToTime, ft as setElementItem, ar as setValues, ee as sleep, or as splice, Pn as strFill, Ge as strSplit, A as toArray, H as toCamelCase, sr as toCamelCaseFirst, L as toDate, cr as toKebabCase, v as toNumber, lr as toNumberByMax, dr as toPercent, fr as toPercentBy100, a as toString, Ke as transformation, pr as uint8ArrayToBase64, nr as uniqueArray, mr as writeClipboardData };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Возвращает первый элемент массива или объекта
|
|
3
|
+
*
|
|
4
|
+
* Returns the first element of an array or object
|
|
5
|
+
* @param value Входное значение
|
|
6
|
+
* @returns Первый элемент массива или объекта
|
|
7
|
+
*/
|
|
8
|
+
export declare function getFirst<T>(value: T | T[] | Record<string, T>): T | undefined;
|
package/dist/src/library.d.ts
CHANGED
|
@@ -85,6 +85,7 @@ export * from './functions/getElementOrWindow';
|
|
|
85
85
|
export * from './functions/getElementSafeScript';
|
|
86
86
|
export * from './functions/getExactSearchExp';
|
|
87
87
|
export * from './functions/getExp';
|
|
88
|
+
export * from './functions/getFirst';
|
|
88
89
|
export * from './functions/getHydrationData';
|
|
89
90
|
export * from './functions/getItemByPath';
|
|
90
91
|
export * from './functions/getKey';
|
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.2.0",
|
|
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": [
|
|
@@ -75,8 +75,7 @@
|
|
|
75
75
|
".": {
|
|
76
76
|
"import": "./dist/library.js",
|
|
77
77
|
"types": "./dist/src/library.d.ts"
|
|
78
|
-
}
|
|
79
|
-
"./types/*": "./dist/src/*"
|
|
78
|
+
}
|
|
80
79
|
},
|
|
81
80
|
"engines": {
|
|
82
81
|
"node": ">=20.0.0"
|