usemods-nuxt 0.0.21 → 0.0.22
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/module.json +2 -2
- package/dist/module.mjs +1 -1
- package/dist/runtime/utils/actions.d.ts +1 -1
- package/dist/runtime/utils/actions.mjs +3 -3
- package/dist/runtime/utils/animations.mjs +2 -2
- package/dist/runtime/utils/data.d.ts +9 -13
- package/dist/runtime/utils/data.mjs +13 -40
- package/dist/runtime/utils/detections.d.ts +3 -4
- package/dist/runtime/utils/detections.mjs +0 -26
- package/dist/runtime/utils/formatters.d.ts +2 -4
- package/dist/runtime/utils/formatters.mjs +4 -4
- package/dist/runtime/utils/goodies.mjs +2 -2
- package/dist/runtime/utils/modifiers.mjs +3 -3
- package/dist/runtime/utils/validators.d.ts +25 -24
- package/dist/runtime/utils/validators.mjs +2 -2
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -5,7 +5,7 @@ export declare function scrollToAnchor(id: string): Promise<void>;
|
|
|
5
5
|
/**
|
|
6
6
|
* Toggles the body scroll with specified class names and returns a promise
|
|
7
7
|
*/
|
|
8
|
-
export declare function toggleBodyScroll(className?: string): Promise<void>;
|
|
8
|
+
export declare function toggleBodyScroll(className?: string, action?: 'add' | 'remove' | 'toggle'): Promise<void>;
|
|
9
9
|
/**
|
|
10
10
|
* Toggles the element scroll with specified class names and returns a promise
|
|
11
11
|
*/
|
|
@@ -15,14 +15,14 @@ export function scrollToAnchor(id) {
|
|
|
15
15
|
}, 180);
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
export function toggleBodyScroll(className = "fixed") {
|
|
18
|
+
export function toggleBodyScroll(className = "fixed", action = "toggle") {
|
|
19
19
|
return new Promise((resolve, reject) => {
|
|
20
20
|
try {
|
|
21
21
|
const body = document.body;
|
|
22
22
|
const isFixed = body.classList.contains(className);
|
|
23
23
|
const scrollY = isFixed ? parseInt(body.style.top, 10) : window.scrollY;
|
|
24
24
|
body.style.top = isFixed ? "" : `-${scrollY}px`;
|
|
25
|
-
body.classList
|
|
25
|
+
body.classList[action](className);
|
|
26
26
|
if (isFixed)
|
|
27
27
|
window.scrollTo(0, -scrollY);
|
|
28
28
|
resolve();
|
|
@@ -32,7 +32,7 @@ export function toggleBodyScroll(className = "fixed") {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
export function toggleElementScroll(element) {
|
|
35
|
-
return new Promise((resolve
|
|
35
|
+
return new Promise((resolve) => {
|
|
36
36
|
if (element.dataset.isScrollLocked === "true") {
|
|
37
37
|
element.style.overflow = "";
|
|
38
38
|
delete element.dataset.isScrollLocked;
|
|
@@ -6,10 +6,10 @@ export function animateText(text, options = {}) {
|
|
|
6
6
|
const elements = text.split(delimiter);
|
|
7
7
|
const result = elements.map((element, index) => {
|
|
8
8
|
const delay = `${index * time}${unit}`;
|
|
9
|
-
const spanStyle =
|
|
9
|
+
const spanStyle = "display: inline-block; position: relative;";
|
|
10
10
|
const translateStyle = `position: absolute; top: 0; left: 0; animation-delay: ${delay};`;
|
|
11
11
|
if (element === " " && splitBy === "character") {
|
|
12
|
-
return
|
|
12
|
+
return '<span class="space" style="white-space: pre;"> </span>';
|
|
13
13
|
} else {
|
|
14
14
|
return `<span class="relative overflow-clip" style="${spanStyle}">
|
|
15
15
|
<span class="ghost" style="visibility: hidden;">${element}</span>
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shuffles your data in a random order.
|
|
3
|
-
*/
|
|
4
|
-
export declare function dataShuffle(items: object | any[]): any;
|
|
5
|
-
/**
|
|
6
|
-
* Reverse an array.
|
|
7
|
-
*/
|
|
8
|
-
export declare function dataReverse(items: object | any[]): any;
|
|
9
1
|
/**
|
|
10
2
|
* Sort an array or object by a property.
|
|
11
3
|
*/
|
|
12
|
-
export declare function dataSortBy(items: object |
|
|
4
|
+
export declare function dataSortBy(items: object | string[] | number[], options?: {
|
|
13
5
|
property?: string;
|
|
14
6
|
order?: 'asc' | 'desc';
|
|
15
|
-
}):
|
|
7
|
+
}): object | string[] | number[];
|
|
8
|
+
/**
|
|
9
|
+
* Reverse an array.
|
|
10
|
+
*/
|
|
11
|
+
export declare function dataReverse(items: object | string[] | number[]): object | string[] | number[];
|
|
16
12
|
/**
|
|
17
13
|
* Returns single unique values within an array or object
|
|
18
14
|
*/
|
|
19
|
-
export declare function dataRemoveDuplicates(...arrays:
|
|
15
|
+
export declare function dataRemoveDuplicates<T extends string | number>(...arrays: T[][]): T[];
|
|
20
16
|
/**
|
|
21
17
|
* Flatten an array of arrays or an object of objects into a single array or object. That was hard to say.
|
|
22
18
|
*/
|
|
23
|
-
export declare function dataFlatten(items: object |
|
|
19
|
+
export declare function dataFlatten(items: object | string[] | number[]): object | string[] | number[];
|
|
24
20
|
/**
|
|
25
21
|
* Returns an array without a property or properties.
|
|
26
22
|
*/
|
|
27
|
-
export declare function dataWithout(items: object |
|
|
23
|
+
export declare function dataWithout(items: object | string[] | number[], properties: string | number | string[] | number[]): object | string[] | number[];
|
|
@@ -1,43 +1,4 @@
|
|
|
1
|
-
import { isObject
|
|
2
|
-
export function dataShuffle(items) {
|
|
3
|
-
if (!items || !(isObject(items) || isArray(items))) {
|
|
4
|
-
console.warn("[MODS] Warning: dataShuffle() expects an object or array as the first argument.");
|
|
5
|
-
return items;
|
|
6
|
-
}
|
|
7
|
-
const shuffleArray = (array) => {
|
|
8
|
-
let shuffled = false;
|
|
9
|
-
while (!shuffled) {
|
|
10
|
-
for (let i = array.length - 1; i > 0; i--) {
|
|
11
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
12
|
-
[array[i], array[j]] = [array[j], array[i]];
|
|
13
|
-
}
|
|
14
|
-
shuffled = !array.every((element, index) => {
|
|
15
|
-
if (Array.isArray(items))
|
|
16
|
-
return element === items[index];
|
|
17
|
-
return false;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return array;
|
|
21
|
-
};
|
|
22
|
-
if (isObject(items)) {
|
|
23
|
-
const entries = Object.entries(items);
|
|
24
|
-
return Object.fromEntries(shuffleArray(entries));
|
|
25
|
-
} else {
|
|
26
|
-
return shuffleArray([...items]);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export function dataReverse(items) {
|
|
30
|
-
if (!items || !(isObject(items) || isArray(items))) {
|
|
31
|
-
console.warn("[MODS] Warning: dataReverse() expects an object or array as the first argument.");
|
|
32
|
-
return items;
|
|
33
|
-
}
|
|
34
|
-
if (isObject(items)) {
|
|
35
|
-
const entries = Object.entries(items);
|
|
36
|
-
return Object.fromEntries(entries.reverse());
|
|
37
|
-
} else {
|
|
38
|
-
return items.reverse();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
1
|
+
import { isObject } from "./validators.mjs";
|
|
41
2
|
export function dataSortBy(items, options) {
|
|
42
3
|
const comparator = (a, b) => {
|
|
43
4
|
const property = options?.property;
|
|
@@ -57,6 +18,18 @@ export function dataSortBy(items, options) {
|
|
|
57
18
|
return items.sort(comparator);
|
|
58
19
|
}
|
|
59
20
|
}
|
|
21
|
+
export function dataReverse(items) {
|
|
22
|
+
if (!items) {
|
|
23
|
+
console.warn("[MODS] Warning: dataReverse() expects an object or array as the first argument.");
|
|
24
|
+
return items;
|
|
25
|
+
}
|
|
26
|
+
if (isObject(items)) {
|
|
27
|
+
const entries = Object.entries(items);
|
|
28
|
+
return Object.fromEntries(entries.reverse());
|
|
29
|
+
} else {
|
|
30
|
+
return items.reverse();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
60
33
|
export function dataRemoveDuplicates(...arrays) {
|
|
61
34
|
const mergedArray = arrays.flat();
|
|
62
35
|
return mergedArray.filter((item, index) => mergedArray.indexOf(item) === index);
|
|
@@ -64,10 +64,6 @@ export declare function detectDeviceOrientation(): string;
|
|
|
64
64
|
* Detect the current breakpoint based on Tailwind CSS breakpoints
|
|
65
65
|
*/
|
|
66
66
|
export declare function detectBreakpoint(): string;
|
|
67
|
-
/**
|
|
68
|
-
* Detect any container breakpoint based on Tailwind CSS breakpoints
|
|
69
|
-
*/
|
|
70
|
-
export declare function detectContainerBreakpoint(element: HTMLElement): string;
|
|
71
67
|
/**
|
|
72
68
|
* Detect the current network status of the user (Online or Offline)
|
|
73
69
|
*/
|
|
@@ -108,3 +104,6 @@ export declare function detectPort(): string;
|
|
|
108
104
|
/**
|
|
109
105
|
* Detects if the element is currently in the container via ID
|
|
110
106
|
*/
|
|
107
|
+
/**
|
|
108
|
+
* Detect any container breakpoint based on Tailwind CSS breakpoints
|
|
109
|
+
*/
|
|
@@ -74,32 +74,6 @@ export function detectBreakpoint() {
|
|
|
74
74
|
return "xl";
|
|
75
75
|
return "2xl";
|
|
76
76
|
}
|
|
77
|
-
export function detectContainerBreakpoint(element) {
|
|
78
|
-
const width = element.getBoundingClientRect().width;
|
|
79
|
-
if (width < 320)
|
|
80
|
-
return "@xs";
|
|
81
|
-
if (width < 384)
|
|
82
|
-
return "@sm";
|
|
83
|
-
if (width < 448)
|
|
84
|
-
return "@md";
|
|
85
|
-
if (width < 512)
|
|
86
|
-
return "@lg";
|
|
87
|
-
if (width < 576)
|
|
88
|
-
return "@xl";
|
|
89
|
-
if (width < 672)
|
|
90
|
-
return "@2xl";
|
|
91
|
-
if (width < 768)
|
|
92
|
-
return "@3xl";
|
|
93
|
-
if (width < 896)
|
|
94
|
-
return "@4xl";
|
|
95
|
-
if (width < 1024)
|
|
96
|
-
return "@5xl";
|
|
97
|
-
if (width < 1152)
|
|
98
|
-
return "@6xl";
|
|
99
|
-
if (width < 1280)
|
|
100
|
-
return "@7xl";
|
|
101
|
-
return "@7xl";
|
|
102
|
-
}
|
|
103
77
|
export function detectNetworkStatus() {
|
|
104
78
|
return navigator.onLine ? "Online" : "Offline";
|
|
105
79
|
}
|
|
@@ -52,16 +52,14 @@ export declare function formatInitials(text: string, options?: {
|
|
|
52
52
|
*/
|
|
53
53
|
export declare function formatUnixTime(timestamp: number): string;
|
|
54
54
|
/**
|
|
55
|
-
* Create a string of comma-separated values from an array, object or string with an optional limit and conjunction
|
|
55
|
+
* Create a string of comma-separated values from an array, object, or string with an optional limit and conjunction
|
|
56
56
|
*/
|
|
57
|
-
export declare function formatList(items: string | object |
|
|
57
|
+
export declare function formatList(items: string | object | string[], options?: {
|
|
58
58
|
limit?: number;
|
|
59
59
|
conjunction?: string;
|
|
60
60
|
}): string;
|
|
61
61
|
/**
|
|
62
62
|
* Converts a string to title case following the Chicago Manual of Style rules.
|
|
63
|
-
* @reference https://www.chicagomanualofstyle.org/book/ed17/frontmatter/toc.html
|
|
64
|
-
|
|
65
63
|
*/
|
|
66
64
|
export declare function formatTitle(text: string): string;
|
|
67
65
|
/**
|
|
@@ -39,7 +39,7 @@ const currencySymbols = /* @__PURE__ */ new Map([
|
|
|
39
39
|
]);
|
|
40
40
|
export function formatNumber(number, options) {
|
|
41
41
|
const safeDecimals = Math.max(0, Math.min(options?.decimals ?? 2, 20));
|
|
42
|
-
|
|
42
|
+
const config = {
|
|
43
43
|
style: "decimal",
|
|
44
44
|
minimumFractionDigits: safeDecimals === 0 ? 0 : safeDecimals === 1 ? 1 : 2,
|
|
45
45
|
maximumFractionDigits: safeDecimals
|
|
@@ -48,7 +48,7 @@ export function formatNumber(number, options) {
|
|
|
48
48
|
}
|
|
49
49
|
export function formatCurrency(number, options) {
|
|
50
50
|
const safeDecimals = Math.max(0, Math.min(options?.decimals ?? 2, 20));
|
|
51
|
-
|
|
51
|
+
const config = {
|
|
52
52
|
style: "currency",
|
|
53
53
|
currencyDisplay: "narrowSymbol",
|
|
54
54
|
minimumFractionDigits: safeDecimals === 0 ? 0 : safeDecimals === 1 ? 1 : 2,
|
|
@@ -59,7 +59,7 @@ export function formatCurrency(number, options) {
|
|
|
59
59
|
}
|
|
60
60
|
export function formatValuation(number, options) {
|
|
61
61
|
const safeDecimals = Math.max(0, Math.min(options?.decimals ?? 2, 20));
|
|
62
|
-
|
|
62
|
+
const config = {
|
|
63
63
|
style: "currency",
|
|
64
64
|
currencyDisplay: "narrowSymbol",
|
|
65
65
|
notation: "compact",
|
|
@@ -72,7 +72,7 @@ export function formatValuation(number, options) {
|
|
|
72
72
|
}
|
|
73
73
|
export function formatPercentage(value, options) {
|
|
74
74
|
const safeDecimals = Math.max(0, Math.min(options?.decimals ?? 2, 20));
|
|
75
|
-
|
|
75
|
+
const config = {
|
|
76
76
|
style: "percent",
|
|
77
77
|
minimumFractionDigits: safeDecimals === 0 ? 0 : safeDecimals === 1 ? 1 : 2,
|
|
78
78
|
maximumFractionDigits: safeDecimals
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { formatDurationLabels } from "./formatters.mjs";
|
|
2
2
|
export function splitByWords(text) {
|
|
3
|
-
const sentences = text.split(/([
|
|
3
|
+
const sentences = text.split(/([.?!]\s*)/);
|
|
4
4
|
let wordIndex = 0;
|
|
5
|
-
|
|
5
|
+
const combinedSentences = [];
|
|
6
6
|
for (let i = 0; i < sentences.length; i += 2) {
|
|
7
7
|
const sentence = sentences[i] + (sentences[i + 1] || "");
|
|
8
8
|
if (sentence.trim() === "")
|
|
@@ -148,13 +148,13 @@ export function stripNumbers(text) {
|
|
|
148
148
|
return text.replace(/[0-9]/g, "");
|
|
149
149
|
}
|
|
150
150
|
export function stripPunctuation(text) {
|
|
151
|
-
return text.replace(/[
|
|
151
|
+
return text.replace(/[.,/#!$%^&*;:{}=\-_`~()]/g, "");
|
|
152
152
|
}
|
|
153
153
|
export function stripSymbols(text) {
|
|
154
154
|
return text.replace(/[^\w\s]|_/g, "");
|
|
155
155
|
}
|
|
156
156
|
export function stripEmojis(text) {
|
|
157
|
-
return text.replace(/[\
|
|
157
|
+
return text.replace(/[\u{1F600}-\u{1F64F}]/gu, "").replace(/[\u{1F300}-\u{1F5FF}]/gu, "").replace(/[\u{1F680}-\u{1F6FF}]/gu, "").replace(/[\u{1F700}-\u{1F77F}]/gu, "").replace(/[\u{1F780}-\u{1F7FF}]/gu, "").replace(/[\u{1F800}-\u{1F8FF}]/gu, "").replace(/[\u{1F900}-\u{1F9FF}]/gu, "").replace(/[\u{1FA00}-\u{1FA6F}]/gu, "").replace(/[\u{1FA70}-\u{1FAFF}]/gu, "").replace(/[\u{2600}-\u{26FF}]/gu, "").replace(/[\u{2700}-\u{27BF}]/gu, "");
|
|
158
158
|
}
|
|
159
159
|
export function slugify(text) {
|
|
160
160
|
return text.toLowerCase().replace(/[^\w ]+/g, "").replace(/ +/g, "-");
|
|
@@ -181,7 +181,7 @@ export function kebabCase(text) {
|
|
|
181
181
|
}).replace(/\s+/g, "");
|
|
182
182
|
}
|
|
183
183
|
export function titleCase(text) {
|
|
184
|
-
return text.replace(/(?:^\w|[A-Z]|\b\w)/g, (word
|
|
184
|
+
return text.replace(/(?:^\w|[A-Z]|\b\w)/g, (word) => {
|
|
185
185
|
return word.toUpperCase();
|
|
186
186
|
}).replace(/\s+/g, " ");
|
|
187
187
|
}
|
|
@@ -1,67 +1,68 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Check if any given value is a valid email address.
|
|
3
3
|
*/
|
|
4
|
-
export declare function isEmail(value:
|
|
4
|
+
export declare function isEmail(value: string): boolean;
|
|
5
5
|
/**
|
|
6
6
|
* Check if any given value is a valid number.
|
|
7
7
|
*/
|
|
8
|
-
export declare function isNumber(value:
|
|
8
|
+
export declare function isNumber(value: string | number): boolean;
|
|
9
9
|
/**
|
|
10
10
|
* Check if any given value is a valid URL.
|
|
11
11
|
*/
|
|
12
|
-
export declare function isUrl(value:
|
|
12
|
+
export declare function isUrl(value: string): boolean;
|
|
13
|
+
/**
|
|
13
14
|
/**
|
|
14
15
|
* Check if any given string, array or object is empty.
|
|
15
16
|
*/
|
|
16
|
-
export declare function isEmpty(value:
|
|
17
|
+
export declare function isEmpty(value: string | string[] | number[] | object | null | undefined): boolean;
|
|
17
18
|
/**
|
|
18
19
|
* Check if any given value is a valid UUID.
|
|
19
20
|
*/
|
|
20
|
-
export declare function isUuid(value:
|
|
21
|
+
export declare function isUuid(value: string): boolean;
|
|
21
22
|
/**
|
|
22
23
|
* Check if any given value is a valid JSON string.
|
|
23
24
|
*/
|
|
24
|
-
export declare function isJson(value:
|
|
25
|
+
export declare function isJson(value: string): boolean;
|
|
25
26
|
/**
|
|
26
27
|
* Check if any given value is an object.
|
|
27
28
|
*/
|
|
28
|
-
export declare function isObject(value:
|
|
29
|
+
export declare function isObject(value: object): boolean;
|
|
29
30
|
/**
|
|
30
31
|
* Check if any given value is an array.
|
|
31
32
|
*/
|
|
32
|
-
export declare function isArray(value:
|
|
33
|
+
export declare function isArray(value: string[] | number[]): boolean;
|
|
33
34
|
/**
|
|
34
35
|
* Check if any given value is a valid hexadecimal color code.
|
|
35
36
|
*/
|
|
36
|
-
export declare function isHex(value:
|
|
37
|
+
export declare function isHex(value: string): boolean;
|
|
37
38
|
/**
|
|
38
39
|
* Check if any given value contains only alphabetic characters.
|
|
39
40
|
*/
|
|
40
|
-
export declare function isAlphabetic(value:
|
|
41
|
+
export declare function isAlphabetic(value: string): boolean;
|
|
41
42
|
/**
|
|
42
43
|
* Check if any given value contains only alphanumeric characters.
|
|
43
44
|
*/
|
|
44
|
-
export declare function isAlphanumeric(value:
|
|
45
|
+
export declare function isAlphanumeric(value: string): boolean;
|
|
45
46
|
/**
|
|
46
47
|
* Check if any given value is a boolean value.
|
|
47
48
|
*/
|
|
48
|
-
export declare function isBoolean(value:
|
|
49
|
+
export declare function isBoolean(value: boolean): boolean;
|
|
49
50
|
/**
|
|
50
51
|
* Check if any given value is undefined.
|
|
51
52
|
*/
|
|
52
|
-
export declare function isUndefined(value:
|
|
53
|
+
export declare function isUndefined(value: undefined): boolean;
|
|
53
54
|
/**
|
|
54
55
|
* Check if any given value is null.
|
|
55
56
|
*/
|
|
56
|
-
export declare function isNull(value:
|
|
57
|
+
export declare function isNull(value: null): boolean;
|
|
57
58
|
/**
|
|
58
59
|
* Check if any given value is a valid Date object.
|
|
59
60
|
*/
|
|
60
|
-
export declare function isDate(value:
|
|
61
|
+
export declare function isDate(value: Date): boolean;
|
|
61
62
|
/**
|
|
62
63
|
* Check if any given value is a valid time in HH:mm format.
|
|
63
64
|
*/
|
|
64
|
-
export declare function isTime(value:
|
|
65
|
+
export declare function isTime(value: string): boolean;
|
|
65
66
|
/**
|
|
66
67
|
* Check if any given value year is a leap year.
|
|
67
68
|
*/
|
|
@@ -97,11 +98,11 @@ export declare function isPrime(value: number): boolean;
|
|
|
97
98
|
/**
|
|
98
99
|
* Check if the number is an integer.
|
|
99
100
|
*/
|
|
100
|
-
export declare function isInteger(value:
|
|
101
|
+
export declare function isInteger(value: number): boolean;
|
|
101
102
|
/**
|
|
102
103
|
* Check if the number is a float.
|
|
103
104
|
*/
|
|
104
|
-
export declare function isFloat(value:
|
|
105
|
+
export declare function isFloat(value: number): boolean;
|
|
105
106
|
/**
|
|
106
107
|
* Check if the number is between the specified range.
|
|
107
108
|
*/
|
|
@@ -113,23 +114,23 @@ export declare function isDivisibleBy(value: number, divisor: number): boolean;
|
|
|
113
114
|
/**
|
|
114
115
|
* Check if any given value is a valid credit card number.
|
|
115
116
|
*/
|
|
116
|
-
export declare function isCreditCard(value:
|
|
117
|
+
export declare function isCreditCard(value: string): boolean;
|
|
117
118
|
/**
|
|
118
119
|
* Check if any given value is a valid latitude-longitude coordinate in the format lat,lng or lat,lng.
|
|
119
120
|
*/
|
|
120
|
-
export declare function isLatLng(value:
|
|
121
|
+
export declare function isLatLng(value: string): boolean;
|
|
121
122
|
/**
|
|
122
123
|
* Check if any given value is a valid latitude coordinate.
|
|
123
124
|
*/
|
|
124
|
-
export declare function isLatitude(value:
|
|
125
|
+
export declare function isLatitude(value: string): boolean;
|
|
125
126
|
/**
|
|
126
127
|
* Check if any given value is a valid longitude coordinate.
|
|
127
128
|
*/
|
|
128
|
-
export declare function isLongitude(value:
|
|
129
|
+
export declare function isLongitude(value: string): boolean;
|
|
129
130
|
/**
|
|
130
131
|
* Check if any given value is a valid IP address.
|
|
131
132
|
*/
|
|
132
|
-
export declare function isIpAddress(value:
|
|
133
|
+
export declare function isIpAddress(value: string): boolean;
|
|
133
134
|
/**
|
|
134
135
|
* Check if any given value is a valid port number.
|
|
135
136
|
*/
|
|
@@ -137,7 +138,7 @@ export declare function isPort(value: number): boolean;
|
|
|
137
138
|
/**
|
|
138
139
|
* Check if any given value is a valid MAC address.
|
|
139
140
|
*/
|
|
140
|
-
export declare function isMacAddress(value:
|
|
141
|
+
export declare function isMacAddress(value: string): boolean;
|
|
141
142
|
/**
|
|
142
143
|
* Check if you're a passionate iPhone fan.
|
|
143
144
|
*/
|
|
@@ -9,7 +9,7 @@ export function isNumber(value) {
|
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
11
|
export function isUrl(value) {
|
|
12
|
-
const regex = /^(?:\w+:)?\/\/([^\s
|
|
12
|
+
const regex = /^(?:\w+:)?\/\/([^\s.]+\.\S{2,}|localhost[:?\d]*(?:[^:?\d]\S*)?)$/;
|
|
13
13
|
return regex.test(value);
|
|
14
14
|
}
|
|
15
15
|
export function isEmpty(value) {
|
|
@@ -21,7 +21,7 @@ export function isEmpty(value) {
|
|
|
21
21
|
return value.length === 0;
|
|
22
22
|
if (typeof value === "object")
|
|
23
23
|
return Object.keys(value).length === 0;
|
|
24
|
-
return
|
|
24
|
+
return false;
|
|
25
25
|
}
|
|
26
26
|
export function isUuid(value) {
|
|
27
27
|
const regex = /^[a-f\d]{8}(-[a-f\d]{4}){4}[a-f\d]{8}$/i;
|