@okam/core-lib 2.0.0 → 2.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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.1.0 (2026-04-06)
2
+
3
+ This was a version bump only for core-lib to align it with other projects, there were no code changes.
4
+
1
5
  ## 2.0.0 (Unreleased)
2
6
 
3
7
  ### ⚠️ Breaking Changes
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(t,e){if([t,e].forEach((r,n)=>{if(!Number.isSafeInteger(r))throw new TypeError(`${n===0?"min":"max"} is not a valid integer`)}),e<t)throw new Error("Min cannot be greater than max");return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t}class p{static getRandom(e){return e[l(0,e.length-1)]}static removeItem(e,r){const n=e.indexOf(r);return n>-1&&e.splice(n,1),e}}function b(t){if(typeof t!="string"||!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(t))return!1;try{return new Date(t).toISOString()===t}catch{return!1}}function s(t,e=!0){return typeof t=="string"&&(e?t.trim():t).length>0}function d(t){return typeof t=="object"&&t!==null&&t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function a(t){return typeof t=="number"&&Number.isSafeInteger(t)}function g(t){return typeof t=="number"&&!Number.isNaN(t)?!0:s(t)?!Number.isNaN(Number.parseInt(t,10)||Number.isNaN(Number.parseFloat(t))):!1}function y(t){const e=typeof t=="string"&&/^-?\d+$/.test(t)?Number.parseInt(t,10):t;return a(e)}function h(t){return a(t)&&t<600&&t>=100}class o{static isPresent(e,r){if(e==null)throw o.createException(r,"Value is null or undefined.")}static safeInteger(e,r){if(typeof e!="number"||!Number.isSafeInteger(e))throw o.createException(r,"Value is not a safe integer")}static nonEmptyString(e,r,n){if(!s(e,n??!0))throw o.createException(r)}static never(e,r){throw new Error(r??"Unexpected value")}static createException(e,r){throw typeof e=="function"?e():new Error(e??r??"Assertion did not pass.")}}function m(t){return t.split("/").reduceRight((n,i)=>n.length===0&&i===""?n:[i,...n],[]).join("/")}function N(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function f(t,e,r){const n=Object.keys(t);let i;i??=r;for(const u of n){const c=t[u];if(N(c)&&(i??=f(c,e,i)),u===e)return t[e]}return i}function O(t,e){const r=t[e];return r!=null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(t,e)?r:null}function P(t){return t.charAt(0).toUpperCase()+t.slice(1)}exports.ArrayUtils=p;exports.Asserts=o;exports.capitalizeFirstLetter=P;exports.checkObjectProperty=O;exports.getNestedObjectValueOfKey=f;exports.isHttpStatusCode=h;exports.isIsoDateString=b;exports.isNonEmptyString=s;exports.isParsableNumeric=g;exports.isParsableSafeInteger=y;exports.isPlainObject=d;exports.isSafeInteger=a;exports.normalizePath=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(t,e){if([t,e].forEach((r,n)=>{if(!Number.isSafeInteger(r))throw new TypeError(`${n===0?"min":"max"} is not a valid integer`)}),e<t)throw new Error("Min cannot be greater than max");return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t}class p{static getRandom(e){return e[l(0,e.length-1)]}static removeItem(e,r){const n=e.indexOf(r);return n>-1&&e.splice(n,1),e}}const b=/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/;function d(t){if(typeof t!="string"||!b.test(t))return!1;try{return new Date(t).toISOString()===t}catch{return!1}}function s(t,e=!0){return typeof t=="string"&&(e?t.trim():t).length>0}function g(t){return typeof t=="object"&&t!==null&&t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function a(t){return typeof t=="number"&&Number.isSafeInteger(t)}function y(t){return typeof t=="number"&&!Number.isNaN(t)?!0:s(t)?!Number.isNaN(Number.parseInt(t,10)||Number.isNaN(Number.parseFloat(t))):!1}const h=/^-?\d+$/;function m(t){const e=typeof t=="string"&&h.test(t)?Number.parseInt(t,10):t;return a(e)}function N(t){return a(t)&&t<600&&t>=100}class o{static isPresent(e,r){if(e==null)throw o.createException(r,"Value is null or undefined.")}static safeInteger(e,r){if(typeof e!="number"||!Number.isSafeInteger(e))throw o.createException(r,"Value is not a safe integer")}static nonEmptyString(e,r,n){if(!s(e,n??!0))throw o.createException(r)}static never(e,r){throw new Error(r??"Unexpected value")}static createException(e,r){throw typeof e=="function"?e():new Error(e??r??"Assertion did not pass.")}}function O(t){return t.split("/").reduceRight((n,i)=>n.length===0&&i===""?n:[i,...n],[]).join("/")}function I(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function f(t,e,r){const n=Object.keys(t);let i;i??=r;for(const c of n){const u=t[c];if(I(u)&&(i??=f(u,e,i)),c===e)return t[e]}return i}function S(t,e){const r=t[e];return r!=null&&typeof r=="object"&&Object.hasOwn(t,e)?r:null}function j(t){return t.charAt(0).toUpperCase()+t.slice(1)}exports.ArrayUtils=p;exports.Asserts=o;exports.capitalizeFirstLetter=j;exports.checkObjectProperty=S;exports.getNestedObjectValueOfKey=f;exports.isHttpStatusCode=N;exports.isIsoDateString=d;exports.isNonEmptyString=s;exports.isParsableNumeric=y;exports.isParsableSafeInteger=m;exports.isPlainObject=g;exports.isSafeInteger=a;exports.normalizePath=O;
package/index.mjs CHANGED
@@ -6,7 +6,7 @@ function f(t, e) {
6
6
  throw new Error("Min cannot be greater than max");
7
7
  return t = Math.ceil(t), e = Math.floor(e), Math.floor(Math.random() * (e - t + 1)) + t;
8
8
  }
9
- class b {
9
+ class h {
10
10
  static getRandom(e) {
11
11
  return e[f(0, e.length - 1)];
12
12
  }
@@ -15,8 +15,9 @@ class b {
15
15
  return n > -1 && e.splice(n, 1), e;
16
16
  }
17
17
  }
18
- function d(t) {
19
- if (typeof t != "string" || !/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(t))
18
+ const l = /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z/;
19
+ function g(t) {
20
+ if (typeof t != "string" || !l.test(t))
20
21
  return !1;
21
22
  try {
22
23
  return new Date(t).toISOString() === t;
@@ -27,20 +28,21 @@ function d(t) {
27
28
  function c(t, e = !0) {
28
29
  return typeof t == "string" && (e ? t.trim() : t).length > 0;
29
30
  }
30
- function h(t) {
31
+ function y(t) {
31
32
  return typeof t == "object" && t !== null && t.constructor === Object && Object.getPrototypeOf(t) === Object.prototype;
32
33
  }
33
34
  function a(t) {
34
35
  return typeof t == "number" && Number.isSafeInteger(t);
35
36
  }
36
- function g(t) {
37
+ function N(t) {
37
38
  return typeof t == "number" && !Number.isNaN(t) ? !0 : c(t) ? !Number.isNaN(Number.parseInt(t, 10) || Number.isNaN(Number.parseFloat(t))) : !1;
38
39
  }
39
- function y(t) {
40
- const e = typeof t == "string" && /^-?\d+$/.test(t) ? Number.parseInt(t, 10) : t;
40
+ const p = /^-?\d+$/;
41
+ function m(t) {
42
+ const e = typeof t == "string" && p.test(t) ? Number.parseInt(t, 10) : t;
41
43
  return a(e);
42
44
  }
43
- function m(t) {
45
+ function w(t) {
44
46
  return a(t) && t < 600 && t >= 100;
45
47
  }
46
48
  class o {
@@ -63,42 +65,42 @@ class o {
63
65
  throw typeof e == "function" ? e() : new Error(e ?? r ?? "Assertion did not pass.");
64
66
  }
65
67
  }
66
- function N(t) {
68
+ function E(t) {
67
69
  return t.split("/").reduceRight((n, i) => n.length === 0 && i === "" ? n : [i, ...n], []).join("/");
68
70
  }
69
- function l(t) {
71
+ function b(t) {
70
72
  return typeof t == "object" && t !== null && !Array.isArray(t);
71
73
  }
72
- function p(t, e, r) {
74
+ function d(t, e, r) {
73
75
  const n = Object.keys(t);
74
76
  let i;
75
77
  i ??= r;
76
- for (const u of n) {
77
- const s = t[u];
78
- if (l(s) && (i ??= p(s, e, i)), u === e)
78
+ for (const s of n) {
79
+ const u = t[s];
80
+ if (b(u) && (i ??= d(u, e, i)), s === e)
79
81
  return t[e];
80
82
  }
81
83
  return i;
82
84
  }
83
- function w(t, e) {
85
+ function I(t, e) {
84
86
  const r = t[e];
85
- return r != null && typeof r == "object" && Object.prototype.hasOwnProperty.call(t, e) ? r : null;
87
+ return r != null && typeof r == "object" && Object.hasOwn(t, e) ? r : null;
86
88
  }
87
89
  function O(t) {
88
90
  return t.charAt(0).toUpperCase() + t.slice(1);
89
91
  }
90
92
  export {
91
- b as ArrayUtils,
93
+ h as ArrayUtils,
92
94
  o as Asserts,
93
95
  O as capitalizeFirstLetter,
94
- w as checkObjectProperty,
95
- p as getNestedObjectValueOfKey,
96
- m as isHttpStatusCode,
97
- d as isIsoDateString,
96
+ I as checkObjectProperty,
97
+ d as getNestedObjectValueOfKey,
98
+ w as isHttpStatusCode,
99
+ g as isIsoDateString,
98
100
  c as isNonEmptyString,
99
- g as isParsableNumeric,
100
- y as isParsableSafeInteger,
101
- h as isPlainObject,
101
+ N as isParsableNumeric,
102
+ m as isParsableSafeInteger,
103
+ y as isPlainObject,
102
104
  a as isSafeInteger,
103
- N as normalizePath
105
+ E as normalizePath
104
106
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okam/core-lib",
3
- "version": "2.0.0",
3
+ "version": "2.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "url": "https://github.com/OKAMca/stack.git"