@okam/core-lib 1.17.2 → 1.17.4

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
+ ## 1.17.4 (2026-01-23)
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
  ## 1.17.2 (2026-01-21)
2
6
 
3
7
  ### 🩹 Fixes
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("react");function d(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const c=d(p);function b(e,t){if([e,t].forEach((r,n)=>{if(!Number.isSafeInteger(r))throw new TypeError(`${n===0?"min":"max"} is not a valid integer`)}),t<e)throw new Error("Min cannot be greater than max");return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}class g{static getRandom(t){return t[b(0,t.length-1)]}static removeItem(t,r){const n=t.indexOf(r);return n>-1&&t.splice(n,1),t}}function y(e){if(typeof e!="string"||!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(e))return!1;try{return new Date(e).toISOString()===e}catch{return!1}}function s(e,t=!0){return typeof e=="string"&&(t?e.trim():e).length>0}function m(e){return typeof e=="object"&&e!==null&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function u(e){return typeof e=="number"&&Number.isSafeInteger(e)}function h(e){return typeof e=="number"&&!Number.isNaN(e)?!0:s(e)?!Number.isNaN(Number.parseInt(e,10)||Number.isNaN(Number.parseFloat(e))):!1}function N(e){const t=typeof e=="string"&&/^-?\d+$/.test(e)?Number.parseInt(e,10):e;return u(t)}function O(e){return u(e)&&e<600&&e>=100}class o{static isPresent(t,r){if(t==null)throw o.createException(r,"Value is null or undefined.")}static safeInteger(t,r){if(typeof t!="number"||!Number.isSafeInteger(t))throw o.createException(r,"Value is not a safe integer")}static nonEmptyString(t,r,n){if(!s(t,n??!0))throw o.createException(r)}static never(t,r){throw new Error(r??"Unexpected value")}static createException(t,r){throw typeof t=="function"?t():new Error(t??r??"Assertion did not pass.")}}function P(){const e=c.createContext(void 0);function t(){const r=c.use(e);if(r===void 0)throw new Error("useCtx must be inside a Provider");return r}return[t,e.Provider]}function j(){const e=c.createContext(void 0);function t(){const r=c.use(e);return r===void 0?{}:r}return[t,e.Provider]}function w(e){return e.split("/").reduceRight((n,i)=>n.length===0&&i===""?n:[i,...n],[]).join("/")}function x(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function l(e,t,r){const n=Object.keys(e);let i;i??=r;for(const a of n){const f=e[a];if(x(f)&&(i??=l(f,t,i)),a===t)return e[t]}return i}function S(e,t){const r=e[t];return r!=null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(e,t)?r:null}function I(e){return e.charAt(0).toUpperCase()+e.slice(1)}function C(e){return`I'm the @okam/shared-ui component telling ${e} !`}exports.ArrayUtils=g;exports.Asserts=o;exports.capitalizeFirstLetter=I;exports.checkObjectProperty=S;exports.createCtx=P;exports.createCtxNullable=j;exports.getNestedObjectValueOfKey=l;exports.isHttpStatusCode=O;exports.isIsoDateString=y;exports.isNonEmptyString=s;exports.isParsableNumeric=h;exports.isParsableSafeInteger=N;exports.isPlainObject=m;exports.isSafeInteger=u;exports.normalizePath=w;exports.sayHello=C;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react");function p(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 d{static getRandom(e){return e[p(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 c(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 u(t){return typeof t=="number"&&Number.isSafeInteger(t)}function y(t){return typeof t=="number"&&!Number.isNaN(t)?!0:c(t)?!Number.isNaN(Number.parseInt(t,10)||Number.isNaN(Number.parseFloat(t))):!1}function h(t){const e=typeof t=="string"&&/^-?\d+$/.test(t)?Number.parseInt(t,10):t;return u(e)}function m(t){return u(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(!c(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 N(){const t=s.createContext(void 0);function e(){const r=s.use(t);if(r===void 0)throw new Error("useCtx must be inside a Provider");return r}return[e,t.Provider]}function P(){const t=s.createContext(void 0);function e(){const r=s.use(t);return r===void 0?{}:r}return[e,t.Provider]}function O(t){return t.split("/").reduceRight((n,i)=>n.length===0&&i===""?n:[i,...n],[]).join("/")}function x(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function l(t,e,r){const n=Object.keys(t);let i;i??=r;for(const a of n){const f=t[a];if(x(f)&&(i??=l(f,e,i)),a===e)return t[e]}return i}function w(t,e){const r=t[e];return r!=null&&typeof r=="object"&&Object.prototype.hasOwnProperty.call(t,e)?r:null}function I(t){return t.charAt(0).toUpperCase()+t.slice(1)}function j(t){return`I'm the @okam/shared-ui component telling ${t} !`}exports.ArrayUtils=d;exports.Asserts=o;exports.capitalizeFirstLetter=I;exports.checkObjectProperty=w;exports.createCtx=N;exports.createCtxNullable=P;exports.getNestedObjectValueOfKey=l;exports.isHttpStatusCode=m;exports.isIsoDateString=b;exports.isNonEmptyString=c;exports.isParsableNumeric=y;exports.isParsableSafeInteger=h;exports.isPlainObject=g;exports.isSafeInteger=u;exports.normalizePath=O;exports.sayHello=j;
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import * as u from "react";
2
- function l(t, e) {
1
+ import { createContext as s, use as a } from "react";
2
+ function p(t, e) {
3
3
  if ([t, e].forEach((r, n) => {
4
4
  if (!Number.isSafeInteger(r))
5
5
  throw new TypeError(`${n === 0 ? "min" : "max"} is not a valid integer`);
@@ -7,16 +7,16 @@ function l(t, e) {
7
7
  throw new Error("Min cannot be greater than max");
8
8
  return t = Math.ceil(t), e = Math.floor(e), Math.floor(Math.random() * (e - t + 1)) + t;
9
9
  }
10
- class b {
10
+ class m {
11
11
  static getRandom(e) {
12
- return e[l(0, e.length - 1)];
12
+ return e[p(0, e.length - 1)];
13
13
  }
14
14
  static removeItem(e, r) {
15
15
  const n = e.indexOf(r);
16
16
  return n > -1 && e.splice(n, 1), e;
17
17
  }
18
18
  }
19
- function h(t) {
19
+ function g(t) {
20
20
  if (typeof t != "string" || !/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(t))
21
21
  return !1;
22
22
  try {
@@ -25,24 +25,24 @@ function h(t) {
25
25
  return !1;
26
26
  }
27
27
  }
28
- function a(t, e = !0) {
28
+ function f(t, e = !0) {
29
29
  return typeof t == "string" && (e ? t.trim() : t).length > 0;
30
30
  }
31
- function m(t) {
31
+ function y(t) {
32
32
  return typeof t == "object" && t !== null && t.constructor === Object && Object.getPrototypeOf(t) === Object.prototype;
33
33
  }
34
- function f(t) {
34
+ function l(t) {
35
35
  return typeof t == "number" && Number.isSafeInteger(t);
36
36
  }
37
- function g(t) {
38
- return typeof t == "number" && !Number.isNaN(t) ? !0 : a(t) ? !Number.isNaN(Number.parseInt(t, 10) || Number.isNaN(Number.parseFloat(t))) : !1;
37
+ function N(t) {
38
+ return typeof t == "number" && !Number.isNaN(t) ? !0 : f(t) ? !Number.isNaN(Number.parseInt(t, 10) || Number.isNaN(Number.parseFloat(t))) : !1;
39
39
  }
40
- function y(t) {
40
+ function w(t) {
41
41
  const e = typeof t == "string" && /^-?\d+$/.test(t) ? Number.parseInt(t, 10) : t;
42
- return f(e);
42
+ return l(e);
43
43
  }
44
- function N(t) {
45
- return f(t) && t < 600 && t >= 100;
44
+ function x(t) {
45
+ return l(t) && t < 600 && t >= 100;
46
46
  }
47
47
  class i {
48
48
  static isPresent(e, r) {
@@ -54,7 +54,7 @@ class i {
54
54
  throw i.createException(r, "Value is not a safe integer");
55
55
  }
56
56
  static nonEmptyString(e, r, n) {
57
- if (!a(e, n ?? !0))
57
+ if (!f(e, n ?? !0))
58
58
  throw i.createException(r);
59
59
  }
60
60
  static never(e, r) {
@@ -64,66 +64,66 @@ class i {
64
64
  throw typeof e == "function" ? e() : new Error(e ?? r ?? "Assertion did not pass.");
65
65
  }
66
66
  }
67
- function w() {
68
- const t = u.createContext(void 0);
67
+ function I() {
68
+ const t = s(void 0);
69
69
  function e() {
70
- const r = u.use(t);
70
+ const r = a(t);
71
71
  if (r === void 0)
72
72
  throw new Error("useCtx must be inside a Provider");
73
73
  return r;
74
74
  }
75
75
  return [e, t.Provider];
76
76
  }
77
- function x() {
78
- const t = u.createContext(void 0);
77
+ function O() {
78
+ const t = s(void 0);
79
79
  function e() {
80
- const r = u.use(t);
80
+ const r = a(t);
81
81
  return r === void 0 ? {} : r;
82
82
  }
83
83
  return [e, t.Provider];
84
84
  }
85
- function I(t) {
85
+ function P(t) {
86
86
  return t.split("/").reduceRight((n, o) => n.length === 0 && o === "" ? n : [o, ...n], []).join("/");
87
87
  }
88
- function p(t) {
88
+ function d(t) {
89
89
  return typeof t == "object" && t !== null && !Array.isArray(t);
90
90
  }
91
- function d(t, e, r) {
91
+ function b(t, e, r) {
92
92
  const n = Object.keys(t);
93
93
  let o;
94
94
  o ??= r;
95
- for (const c of n) {
96
- const s = t[c];
97
- if (p(s) && (o ??= d(s, e, o)), c === e)
95
+ for (const u of n) {
96
+ const c = t[u];
97
+ if (d(c) && (o ??= b(c, e, o)), u === e)
98
98
  return t[e];
99
99
  }
100
100
  return o;
101
101
  }
102
- function O(t, e) {
102
+ function j(t, e) {
103
103
  const r = t[e];
104
104
  return r != null && typeof r == "object" && Object.prototype.hasOwnProperty.call(t, e) ? r : null;
105
105
  }
106
- function P(t) {
106
+ function E(t) {
107
107
  return t.charAt(0).toUpperCase() + t.slice(1);
108
108
  }
109
- function j(t) {
109
+ function C(t) {
110
110
  return `I'm the @okam/shared-ui component telling ${t} !`;
111
111
  }
112
112
  export {
113
- b as ArrayUtils,
113
+ m as ArrayUtils,
114
114
  i as Asserts,
115
- P as capitalizeFirstLetter,
116
- O as checkObjectProperty,
117
- w as createCtx,
118
- x as createCtxNullable,
119
- d as getNestedObjectValueOfKey,
120
- N as isHttpStatusCode,
121
- h as isIsoDateString,
122
- a as isNonEmptyString,
123
- g as isParsableNumeric,
124
- y as isParsableSafeInteger,
125
- m as isPlainObject,
126
- f as isSafeInteger,
127
- I as normalizePath,
128
- j as sayHello
115
+ E as capitalizeFirstLetter,
116
+ j as checkObjectProperty,
117
+ I as createCtx,
118
+ O as createCtxNullable,
119
+ b as getNestedObjectValueOfKey,
120
+ x as isHttpStatusCode,
121
+ g as isIsoDateString,
122
+ f as isNonEmptyString,
123
+ N as isParsableNumeric,
124
+ w as isParsableSafeInteger,
125
+ y as isPlainObject,
126
+ l as isSafeInteger,
127
+ P as normalizePath,
128
+ C as sayHello
129
129
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@okam/core-lib",
3
- "version": "1.17.2",
3
+ "version": "1.17.4",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "url": "https://github.com/OKAMca/stack.git"
@@ -1,8 +1,7 @@
1
- import * as React from 'react';
2
1
  /**
3
2
  * A helper to create a Context and Provider with no upfront default value, and
4
3
  * without having to check for undefined all the time.
5
4
  */
6
- declare function createCtx<A extends object | null>(): readonly [() => A, React.Provider<A | undefined>];
7
- export declare function createCtxNullable<A extends object | null>(): readonly [() => A, React.Provider<A | undefined>];
5
+ declare function createCtx<A extends object | null>(): readonly [() => A, import('react').Provider<A | undefined>];
6
+ export declare function createCtxNullable<A extends object | null>(): readonly [() => A, import('react').Provider<A | undefined>];
8
7
  export default createCtx;