@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.
@@ -64,7 +64,7 @@ var isEmpty = (value) => {
64
64
  };
65
65
  var isNotEmpty = (value) => !isEmpty(value);
66
66
  var isBlank = (value) => {
67
- if (value == null) {
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 n >= 0 && n <= 255 && String(n) === part;
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)$/;
@@ -13,7 +13,7 @@ import {
13
13
  strStart,
14
14
  studlyCase,
15
15
  titleCase
16
- } from "./chunk-F6RSTW65.js";
16
+ } from "./chunk-FBIWZZMA.js";
17
17
 
18
18
  // src/str.ts
19
19
  var Stringable = class {
@@ -1,6 +1,6 @@
1
1
  // src/formatters.ts
2
2
  var capitalize = (value) => {
3
- if (value == null) {
3
+ if (null == value) {
4
4
  return "";
5
5
  }
6
6
  const stringValue = String(value);
@@ -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 (srcVal !== null && "object" === typeof srcVal && !Array.isArray(srcVal) && tgtVal !== null && "object" === typeof tgtVal && !Array.isArray(tgtVal)) {
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;
@@ -45,7 +45,7 @@ __export(formatters_exports, {
45
45
  });
46
46
  module.exports = __toCommonJS(formatters_exports);
47
47
  var capitalize = (value) => {
48
- if (value == null) {
48
+ if (null == value) {
49
49
  return "";
50
50
  }
51
51
  const stringValue = String(value);
@@ -21,7 +21,7 @@ import {
21
21
  strWords,
22
22
  studlyCase,
23
23
  titleCase
24
- } from "./chunk-F6RSTW65.js";
24
+ } from "./chunk-FBIWZZMA.js";
25
25
  export {
26
26
  camelCase,
27
27
  capitalize,
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 (value2 == null) {
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 n >= 0 && n <= 255 && String(n) === part;
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 (value2 == null) {
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 (srcVal !== null && "object" === typeof srcVal && !Array.isArray(srcVal) && tgtVal !== null && "object" === typeof tgtVal && !Array.isArray(tgtVal)) {
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-27YHP2CK.js";
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-Z7G3SIQH.js";
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-XEJLBAXE.js";
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-F6RSTW65.js";
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 (srcVal !== null && "object" === typeof srcVal && !Array.isArray(srcVal) && tgtVal !== null && "object" === typeof tgtVal && !Array.isArray(tgtVal)) {
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
@@ -2,7 +2,7 @@ import {
2
2
  Obj,
3
3
  Objectable,
4
4
  obj
5
- } from "./chunk-Z7G3SIQH.js";
5
+ } from "./chunk-R7H7CYW2.js";
6
6
  import "./chunk-ZJPKS2MQ.js";
7
7
  import "./chunk-LDSWHSRX.js";
8
8
  export {
package/dist/str.cjs CHANGED
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(str_exports);
28
28
 
29
29
  // src/formatters.ts
30
30
  var capitalize = (value) => {
31
- if (value == null) {
31
+ if (null == value) {
32
32
  return "";
33
33
  }
34
34
  const stringValue = String(value);
package/dist/str.js CHANGED
@@ -2,8 +2,8 @@ import {
2
2
  Str,
3
3
  Stringable,
4
4
  str
5
- } from "./chunk-27YHP2CK.js";
6
- import "./chunk-F6RSTW65.js";
5
+ } from "./chunk-CROK2P54.js";
6
+ import "./chunk-FBIWZZMA.js";
7
7
  export {
8
8
  Str,
9
9
  Stringable,
@@ -117,7 +117,7 @@ var isEmpty = (value) => {
117
117
  };
118
118
  var isNotEmpty = (value) => !isEmpty(value);
119
119
  var isBlank = (value) => {
120
- if (value == null) {
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 n >= 0 && n <= 255 && String(n) === part;
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)$/;
@@ -29,7 +29,7 @@ import {
29
29
  isUndefined,
30
30
  isUrl,
31
31
  isUuid
32
- } from "./chunk-XEJLBAXE.js";
32
+ } from "./chunk-CKJ5ZH4M.js";
33
33
  export {
34
34
  blank,
35
35
  filled,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zairakai/js-utils",
3
- "version": "1.0.1",
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
@@ -9,7 +9,7 @@
9
9
  * @returns {string} The capitalized string
10
10
  */
11
11
  export const capitalize = (value: unknown): string => {
12
- if (value == null) {
12
+ if (null == value) {
13
13
  return ''
14
14
  }
15
15
 
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
- srcVal !== null &&
199
+ null !== srcVal &&
200
200
  'object' === typeof srcVal &&
201
201
  !Array.isArray(srcVal) &&
202
- tgtVal !== null &&
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 (value == null) {
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 n >= 0 && n <= 255 && String(n) === part
351
+ return 0 <= n && 255 >= n && String(n) === part
352
352
  })
353
353
  }
354
354