@okam/core-lib 1.13.4 → 1.15.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/index.d.ts +1 -0
- package/index.js +1 -1
- package/index.mjs +10 -5
- package/package.json +1 -1
- package/utils/string-transform.d.ts +1 -0
package/index.d.ts
CHANGED
|
@@ -7,3 +7,4 @@ export { default as createCtx } from './utils/createContext';
|
|
|
7
7
|
export { createCtxNullable } from './utils/createContext';
|
|
8
8
|
export { default as getNestedObjectValueOfKey } from './utils/object-find-deep-nested';
|
|
9
9
|
export { default as checkObjectProperty } from './utils/object-property';
|
|
10
|
+
export { capitalizeFirstLetter } from './utils/string-transform';
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react"),p=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}},c=(e,t=!0)=>typeof e=="string"&&(t?e.trim():e).length>0,b=e=>typeof e=="object"&&e!==null&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype,a=e=>typeof e=="number"&&Number.isSafeInteger(e),d=e=>typeof e=="number"&&!Number.isNaN(e)?!0:c(e)?!Number.isNaN(Number.parseInt(e,10)||Number.isNaN(Number.parseFloat(e))):!1,g=e=>{const t=typeof e=="string"&&/^-?\d+$/.test(e)?Number.parseInt(e,10):e;return a(t)},y=e=>a(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(!c(t,n??!0))throw o.createException(r)}static never(t,r){throw new Error(r??"Unexpected value")}static createException(t,r){throw typeof t=="string"||t===void 0?new Error(t??r??"Assertion did not pass."):t()}}function h(e,t){if([e,t].forEach((r,n)=>{if(!Number.isSafeInteger(r))throw new Error(`${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 N{static getRandom(t){return t[h(0,t.length-1)]}static removeItem(t,r){const n=t.indexOf(r);return n>-1&&t.splice(n,1),t}}function m(){const e=s.createContext(void 0);function t(){const r=s.useContext(e);if(r===void 0)throw new Error("useCtx must be inside a Provider");return r}return[t,e.Provider]}function x(){const e=s.createContext(void 0);function t(){const r=s.useContext(e);return r===void 0?{}:r}return[t,e.Provider]}function O(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function f(e,t,r){const n=Object.keys(e);let i;i||(i=r);for(const u of n){const l=e[u];if(O(l)&&(i||(i=f(l,t,i))),u===t)return e[t]}return i}const w=(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)}const P=e=>`I'm the @okam/shared-ui component telling ${e} !`;exports.ArrayUtils=N;exports.Asserts=o;exports.capitalizeFirstLetter=I;exports.checkObjectProperty=w;exports.createCtx=m;exports.createCtxNullable=x;exports.getNestedObjectValueOfKey=f;exports.isHttpStatusCode=y;exports.isIsoDateString=p;exports.isNonEmptyString=c;exports.isParsableNumeric=d;exports.isParsableSafeInteger=g;exports.isPlainObject=b;exports.isSafeInteger=a;exports.sayHello=P;
|
package/index.mjs
CHANGED
|
@@ -66,16 +66,16 @@ function I() {
|
|
|
66
66
|
}
|
|
67
67
|
return [e, t.Provider];
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function p(t) {
|
|
70
70
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function d(t, e, r) {
|
|
73
73
|
const n = Object.keys(t);
|
|
74
74
|
let o;
|
|
75
75
|
o || (o = r);
|
|
76
76
|
for (const c of n) {
|
|
77
77
|
const u = t[c];
|
|
78
|
-
if (
|
|
78
|
+
if (p(u) && (o || (o = d(u, e, o))), c === e)
|
|
79
79
|
return t[e];
|
|
80
80
|
}
|
|
81
81
|
return o;
|
|
@@ -83,14 +83,19 @@ function p(t, e, r) {
|
|
|
83
83
|
const O = (t, e) => {
|
|
84
84
|
const r = t[e];
|
|
85
85
|
return r != null && typeof r == "object" && Object.prototype.hasOwnProperty.call(t, e) ? r : null;
|
|
86
|
-
}
|
|
86
|
+
};
|
|
87
|
+
function C(t) {
|
|
88
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
89
|
+
}
|
|
90
|
+
const j = (t) => `I'm the @okam/shared-ui component telling ${t} !`;
|
|
87
91
|
export {
|
|
88
92
|
x as ArrayUtils,
|
|
89
93
|
i as Asserts,
|
|
94
|
+
C as capitalizeFirstLetter,
|
|
90
95
|
O as checkObjectProperty,
|
|
91
96
|
w as createCtx,
|
|
92
97
|
I as createCtxNullable,
|
|
93
|
-
|
|
98
|
+
d as getNestedObjectValueOfKey,
|
|
94
99
|
m as isHttpStatusCode,
|
|
95
100
|
h as isIsoDateString,
|
|
96
101
|
a as isNonEmptyString,
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function capitalizeFirstLetter(str: string): string;
|