@zairakai/js-utils 1.0.1 → 1.0.3
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/{chunk-XEJLBAXE.js → chunk-CKJ5ZH4M.js} +2 -2
- package/dist/{chunk-27YHP2CK.js → chunk-CROK2P54.js} +1 -1
- package/dist/{chunk-F6RSTW65.js → chunk-FBIWZZMA.js} +1 -1
- package/dist/{chunk-Z7G3SIQH.js → chunk-R7H7CYW2.js} +1 -1
- package/dist/formatters.cjs +1 -1
- package/dist/formatters.js +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/obj.cjs +1 -1
- package/dist/obj.js +1 -1
- package/dist/str.cjs +1 -1
- package/dist/str.js +2 -2
- package/dist/validators.cjs +2 -2
- package/dist/validators.js +1 -1
- package/package.json +1 -1
- package/src/formatters.ts +1 -1
- package/src/obj.ts +2 -2
- package/src/validators.ts +2 -2
|
@@ -64,7 +64,7 @@ var isEmpty = (value) => {
|
|
|
64
64
|
};
|
|
65
65
|
var isNotEmpty = (value) => !isEmpty(value);
|
|
66
66
|
var isBlank = (value) => {
|
|
67
|
-
if (
|
|
67
|
+
if (null == value) {
|
|
68
68
|
return true;
|
|
69
69
|
}
|
|
70
70
|
if ("string" === typeof value) {
|
|
@@ -123,7 +123,7 @@ var isIp = (value) => {
|
|
|
123
123
|
if (ipv4.test(value)) {
|
|
124
124
|
return value.split(".").every((part) => {
|
|
125
125
|
const n = Number(part);
|
|
126
|
-
return
|
|
126
|
+
return 0 <= n && 255 >= n && String(n) === part;
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|(([0-9a-fA-F]{1,4}:){0,7}:)|(:[0-9a-fA-F]{1,4}){1,7}|(([0-9a-fA-F]{1,4}:){1,7}:)|(([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4})|::1)$/;
|
|
@@ -181,7 +181,7 @@ var Objectable = class _Objectable {
|
|
|
181
181
|
for (const key of Object.keys(source)) {
|
|
182
182
|
const srcVal = source[key];
|
|
183
183
|
const tgtVal = target[key];
|
|
184
|
-
if (
|
|
184
|
+
if (null !== srcVal && "object" === typeof srcVal && !Array.isArray(srcVal) && null !== tgtVal && "object" === typeof tgtVal && !Array.isArray(tgtVal)) {
|
|
185
185
|
result[key] = merge(tgtVal, srcVal);
|
|
186
186
|
} else {
|
|
187
187
|
result[key] = srcVal;
|
package/dist/formatters.cjs
CHANGED
package/dist/formatters.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -247,7 +247,7 @@ var isEmpty = (value2) => {
|
|
|
247
247
|
};
|
|
248
248
|
var isNotEmpty = (value2) => !isEmpty(value2);
|
|
249
249
|
var isBlank = (value2) => {
|
|
250
|
-
if (
|
|
250
|
+
if (null == value2) {
|
|
251
251
|
return true;
|
|
252
252
|
}
|
|
253
253
|
if ("string" === typeof value2) {
|
|
@@ -306,7 +306,7 @@ var isIp = (value2) => {
|
|
|
306
306
|
if (ipv4.test(value2)) {
|
|
307
307
|
return value2.split(".").every((part) => {
|
|
308
308
|
const n = Number(part);
|
|
309
|
-
return
|
|
309
|
+
return 0 <= n && 255 >= n && String(n) === part;
|
|
310
310
|
});
|
|
311
311
|
}
|
|
312
312
|
const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|(([0-9a-fA-F]{1,4}:){0,7}:)|(:[0-9a-fA-F]{1,4}){1,7}|(([0-9a-fA-F]{1,4}:){1,7}:)|(([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4})|::1)$/;
|
|
@@ -315,7 +315,7 @@ var isIp = (value2) => {
|
|
|
315
315
|
|
|
316
316
|
// src/formatters.ts
|
|
317
317
|
var capitalize = (value2) => {
|
|
318
|
-
if (
|
|
318
|
+
if (null == value2) {
|
|
319
319
|
return "";
|
|
320
320
|
}
|
|
321
321
|
const stringValue = String(value2);
|
|
@@ -2137,7 +2137,7 @@ var Objectable = class _Objectable {
|
|
|
2137
2137
|
for (const key of Object.keys(source)) {
|
|
2138
2138
|
const srcVal = source[key];
|
|
2139
2139
|
const tgtVal = target[key];
|
|
2140
|
-
if (
|
|
2140
|
+
if (null !== srcVal && "object" === typeof srcVal && !Array.isArray(srcVal) && null !== tgtVal && "object" === typeof tgtVal && !Array.isArray(tgtVal)) {
|
|
2141
2141
|
result[key] = merge(tgtVal, srcVal);
|
|
2142
2142
|
} else {
|
|
2143
2143
|
result[key] = srcVal;
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
Str,
|
|
3
3
|
Stringable,
|
|
4
4
|
str
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-CROK2P54.js";
|
|
6
6
|
import {
|
|
7
7
|
ValidationInstance,
|
|
8
8
|
Validator,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
Obj,
|
|
18
18
|
Objectable,
|
|
19
19
|
obj
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-R7H7CYW2.js";
|
|
21
21
|
import {
|
|
22
22
|
data_get,
|
|
23
23
|
data_set,
|
|
@@ -62,7 +62,7 @@ import {
|
|
|
62
62
|
isUndefined,
|
|
63
63
|
isUrl,
|
|
64
64
|
isUuid
|
|
65
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-CKJ5ZH4M.js";
|
|
66
66
|
import {
|
|
67
67
|
camelCase,
|
|
68
68
|
capitalize,
|
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
strWords,
|
|
87
87
|
studlyCase,
|
|
88
88
|
titleCase
|
|
89
|
-
} from "./chunk-
|
|
89
|
+
} from "./chunk-FBIWZZMA.js";
|
|
90
90
|
import {
|
|
91
91
|
dayjs,
|
|
92
92
|
fromNow,
|
package/dist/obj.cjs
CHANGED
|
@@ -338,7 +338,7 @@ var Objectable = class _Objectable {
|
|
|
338
338
|
for (const key of Object.keys(source)) {
|
|
339
339
|
const srcVal = source[key];
|
|
340
340
|
const tgtVal = target[key];
|
|
341
|
-
if (
|
|
341
|
+
if (null !== srcVal && "object" === typeof srcVal && !Array.isArray(srcVal) && null !== tgtVal && "object" === typeof tgtVal && !Array.isArray(tgtVal)) {
|
|
342
342
|
result[key] = merge(tgtVal, srcVal);
|
|
343
343
|
} else {
|
|
344
344
|
result[key] = srcVal;
|
package/dist/obj.js
CHANGED
package/dist/str.cjs
CHANGED
package/dist/str.js
CHANGED
package/dist/validators.cjs
CHANGED
|
@@ -117,7 +117,7 @@ var isEmpty = (value) => {
|
|
|
117
117
|
};
|
|
118
118
|
var isNotEmpty = (value) => !isEmpty(value);
|
|
119
119
|
var isBlank = (value) => {
|
|
120
|
-
if (
|
|
120
|
+
if (null == value) {
|
|
121
121
|
return true;
|
|
122
122
|
}
|
|
123
123
|
if ("string" === typeof value) {
|
|
@@ -176,7 +176,7 @@ var isIp = (value) => {
|
|
|
176
176
|
if (ipv4.test(value)) {
|
|
177
177
|
return value.split(".").every((part) => {
|
|
178
178
|
const n = Number(part);
|
|
179
|
-
return
|
|
179
|
+
return 0 <= n && 255 >= n && String(n) === part;
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|(([0-9a-fA-F]{1,4}:){0,7}:)|(:[0-9a-fA-F]{1,4}){1,7}|(([0-9a-fA-F]{1,4}:){1,7}:)|(([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4})|::1)$/;
|
package/dist/validators.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zairakai/js-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Laravel-inspired TypeScript helpers — fluent strings, numbers, objects, collections, PHP-like arrays, runtime utilities, deep equality, validators, datetime, and Zod schemas",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"helpers",
|
package/src/formatters.ts
CHANGED
package/src/obj.ts
CHANGED
|
@@ -196,10 +196,10 @@ export class Objectable<T extends Record<string, unknown>> {
|
|
|
196
196
|
const srcVal = source[key]
|
|
197
197
|
const tgtVal = target[key]
|
|
198
198
|
if (
|
|
199
|
-
|
|
199
|
+
null !== srcVal &&
|
|
200
200
|
'object' === typeof srcVal &&
|
|
201
201
|
!Array.isArray(srcVal) &&
|
|
202
|
-
|
|
202
|
+
null !== tgtVal &&
|
|
203
203
|
'object' === typeof tgtVal &&
|
|
204
204
|
!Array.isArray(tgtVal)
|
|
205
205
|
) {
|
package/src/validators.ts
CHANGED
|
@@ -209,7 +209,7 @@ export const isNotEmpty = (value: unknown): boolean => !isEmpty(value)
|
|
|
209
209
|
* @returns {boolean} True if the value is blank
|
|
210
210
|
*/
|
|
211
211
|
export const isBlank = (value: unknown): boolean => {
|
|
212
|
-
if (
|
|
212
|
+
if (null == value) {
|
|
213
213
|
return true
|
|
214
214
|
}
|
|
215
215
|
if ('string' === typeof value) {
|
|
@@ -348,7 +348,7 @@ export const isIp = (value: unknown): value is string => {
|
|
|
348
348
|
if (ipv4.test(value)) {
|
|
349
349
|
return value.split('.').every((part) => {
|
|
350
350
|
const n = Number(part)
|
|
351
|
-
return
|
|
351
|
+
return 0 <= n && 255 >= n && String(n) === part
|
|
352
352
|
})
|
|
353
353
|
}
|
|
354
354
|
|