@okam/core-lib 1.17.1 → 1.17.2
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 +13 -0
- package/api/json-api/index.d.ts +1 -1
- package/api/json-api/json-api-error.factory.d.ts +3 -2
- package/api/json-api/json-api-response.factory.d.ts +3 -2
- package/api/json-api/json-api-response.types.d.ts +6 -6
- package/api/json-api/json-api.typeguard.d.ts +3 -4
- package/hooks/index.d.ts +1 -1
- package/hooks/use-promise.d.ts +1 -1
- package/index.d.ts +5 -5
- package/index.js +1 -1
- package/index.mjs +61 -43
- package/package.json +13 -9
- package/utils/array-utils.d.ts +1 -1
- package/utils/createContext.d.ts +3 -4
- package/utils/object-find-deep-nested.d.ts +1 -1
- package/utils/object-property.d.ts +1 -1
- package/utils/string-convert.d.ts +2 -2
- package/utils/typeUtils.d.ts +1 -1
- package/utils/typeguards.d.ts +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## 1.17.2 (2026-01-21)
|
|
2
|
+
|
|
3
|
+
### 🩹 Fixes
|
|
4
|
+
|
|
5
|
+
- upgrade nx and packages ([#29016](https://github.com/OKAMca/stack/issues/29016), [#6](https://github.com/OKAMca/stack/issues/6), [#29755](https://github.com/OKAMca/stack/issues/29755), [#30590](https://github.com/OKAMca/stack/issues/30590), [#385](https://github.com/OKAMca/stack/issues/385), [#33472](https://github.com/OKAMca/stack/issues/33472), [#30359](https://github.com/OKAMca/stack/issues/30359), [#30416](https://github.com/OKAMca/stack/issues/30416), [#392](https://github.com/OKAMca/stack/issues/392), [#14107](https://github.com/OKAMca/stack/issues/14107))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Claude Opus 4.5
|
|
10
|
+
- Marie-Maxime Tanguay @marie-maxime
|
|
11
|
+
- Pierre-Olivier Clerson @poclerson
|
|
12
|
+
- poclerson
|
|
13
|
+
|
|
1
14
|
## 1.17.1 (2026-01-19)
|
|
2
15
|
|
|
3
16
|
### 🚀 Features
|
package/api/json-api/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { JsonApiResponseFactory } from './json-api-response.factory';
|
|
2
|
-
export type {
|
|
2
|
+
export type { JsonApiError, JsonApiErrorResponse, JsonApiResponse, JsonApiResponseMeta, JsonApiSuccessResponse, } from './json-api-response.types';
|
|
3
3
|
export { isJsonApiErrorResponse, isJsonApiResponse, isJsonApiSuccessResponse } from './json-api.typeguard';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Exception } from '@tsed/exceptions';
|
|
2
2
|
import { JsonApiError } from './json-api-response.types';
|
|
3
|
-
|
|
4
3
|
export declare class JsonApiErrorFactory {
|
|
5
4
|
static fromCatchVariable: (error: unknown, defaultHttpStatus?: number) => JsonApiError;
|
|
6
|
-
static fromTsedException: (exception: Exception | Error | string,
|
|
5
|
+
static fromTsedException: (exception: Exception | Error | string,
|
|
6
|
+
/** fallback http status if it can't be inferred from exception */
|
|
7
|
+
defaultHttpStatus?: number) => JsonApiError;
|
|
7
8
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JsonApiError, JsonApiErrorResponse, JsonApiSuccessResponse } from './json-api-response.types';
|
|
2
|
-
|
|
3
2
|
export declare class JsonApiResponseFactory {
|
|
4
|
-
static fromError: (errors: string | JsonApiError | JsonApiError[],
|
|
3
|
+
static fromError: (errors: string | JsonApiError | JsonApiError[],
|
|
4
|
+
/** fallback http status if not present in JsonApiError */
|
|
5
|
+
httpStatus?: number) => JsonApiErrorResponse;
|
|
5
6
|
static fromSuccess: <T>(data: T, metadata?: JsonApiSuccessResponse<T>["meta"]) => JsonApiSuccessResponse<T>;
|
|
6
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @link https://jsonapi.org/format/#errors
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export interface JsonApiError {
|
|
5
5
|
/** a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization. */
|
|
6
6
|
title: string;
|
|
7
7
|
/** a unique identifier for this particular occurrence of the problem. */
|
|
@@ -16,16 +16,16 @@ export type JsonApiError = {
|
|
|
16
16
|
parameter?: string;
|
|
17
17
|
/** a meta object containing non-standard meta-information about the error. */
|
|
18
18
|
meta?: Record<string, unknown>;
|
|
19
|
-
}
|
|
20
|
-
export
|
|
19
|
+
}
|
|
20
|
+
export interface JsonApiErrorResponse {
|
|
21
21
|
success: false;
|
|
22
22
|
errors: JsonApiError[];
|
|
23
|
-
}
|
|
24
|
-
export
|
|
23
|
+
}
|
|
24
|
+
export interface JsonApiResponseMeta {
|
|
25
25
|
meta?: {
|
|
26
26
|
cacheHit?: boolean;
|
|
27
27
|
} & Record<string, string | number | boolean | Record<string, unknown>>;
|
|
28
|
-
}
|
|
28
|
+
}
|
|
29
29
|
export type JsonApiSuccessResponse<T> = {
|
|
30
30
|
success: true;
|
|
31
31
|
data: T;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { JsonApiErrorResponse, JsonApiResponse, JsonApiSuccessResponse } from './json-api-response.types';
|
|
2
|
-
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
5
|
-
export declare const isJsonApiErrorResponse: (val: unknown) => val is JsonApiErrorResponse;
|
|
2
|
+
export declare function isJsonApiResponse<T = unknown>(val: unknown): val is JsonApiResponse<T>;
|
|
3
|
+
export declare function isJsonApiSuccessResponse<T = unknown>(val: unknown): val is JsonApiSuccessResponse<T>;
|
|
4
|
+
export declare function isJsonApiErrorResponse(val: unknown): val is JsonApiErrorResponse;
|
package/hooks/index.d.ts
CHANGED
package/hooks/use-promise.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type AsyncFnParams<TParams> = TParams;
|
|
2
|
-
export type AsyncFnWithParams<TResult, TParams extends Record<string, unknown>> = (
|
|
2
|
+
export type AsyncFnWithParams<TResult, TParams extends Record<string, unknown>> = (_variables: TParams) => Promise<TResult>;
|
|
3
3
|
export type AsyncFnWithoutParams<TResult> = () => Promise<TResult>;
|
|
4
4
|
export type AsyncFn<TResult, TParams extends Record<string, unknown> = Partial<Record<string, unknown>>> = AsyncFnWithParams<TResult, TParams> | AsyncFnWithoutParams<TResult>;
|
|
5
5
|
export interface UsePromiseOptions<TResult> {
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { Asserts } from './utils/asserts';
|
|
2
1
|
export { ArrayUtils } from './utils/array-utils';
|
|
3
|
-
export
|
|
4
|
-
export type { UnPromisify } from './utils/type-utils';
|
|
5
|
-
export declare const sayHello: (name: string) => string;
|
|
2
|
+
export { Asserts } from './utils/asserts';
|
|
6
3
|
export { default as createCtx } from './utils/createContext';
|
|
7
4
|
export { createCtxNullable } from './utils/createContext';
|
|
5
|
+
export declare function sayHello(name: string): string;
|
|
6
|
+
export { normalizePath } from './utils/normalize-path';
|
|
8
7
|
export { default as getNestedObjectValueOfKey } from './utils/object-find-deep-nested';
|
|
9
8
|
export { default as checkObjectProperty } from './utils/object-property';
|
|
10
9
|
export { capitalizeFirstLetter } from './utils/string-transform';
|
|
11
|
-
export {
|
|
10
|
+
export type { UnPromisify } from './utils/type-utils';
|
|
11
|
+
export * from './utils/typeguards';
|
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 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;
|
package/index.mjs
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
function l(t, e) {
|
|
3
|
+
if ([t, e].forEach((r, n) => {
|
|
4
|
+
if (!Number.isSafeInteger(r))
|
|
5
|
+
throw new TypeError(`${n === 0 ? "min" : "max"} is not a valid integer`);
|
|
6
|
+
}), e < t)
|
|
7
|
+
throw new Error("Min cannot be greater than max");
|
|
8
|
+
return t = Math.ceil(t), e = Math.floor(e), Math.floor(Math.random() * (e - t + 1)) + t;
|
|
9
|
+
}
|
|
10
|
+
class b {
|
|
11
|
+
static getRandom(e) {
|
|
12
|
+
return e[l(0, e.length - 1)];
|
|
13
|
+
}
|
|
14
|
+
static removeItem(e, r) {
|
|
15
|
+
const n = e.indexOf(r);
|
|
16
|
+
return n > -1 && e.splice(n, 1), e;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function h(t) {
|
|
3
20
|
if (typeof t != "string" || !/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(t))
|
|
4
21
|
return !1;
|
|
5
22
|
try {
|
|
@@ -7,10 +24,26 @@ const h = (t) => {
|
|
|
7
24
|
} catch {
|
|
8
25
|
return !1;
|
|
9
26
|
}
|
|
10
|
-
}
|
|
27
|
+
}
|
|
28
|
+
function a(t, e = !0) {
|
|
29
|
+
return typeof t == "string" && (e ? t.trim() : t).length > 0;
|
|
30
|
+
}
|
|
31
|
+
function m(t) {
|
|
32
|
+
return typeof t == "object" && t !== null && t.constructor === Object && Object.getPrototypeOf(t) === Object.prototype;
|
|
33
|
+
}
|
|
34
|
+
function f(t) {
|
|
35
|
+
return typeof t == "number" && Number.isSafeInteger(t);
|
|
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;
|
|
39
|
+
}
|
|
40
|
+
function y(t) {
|
|
11
41
|
const e = typeof t == "string" && /^-?\d+$/.test(t) ? Number.parseInt(t, 10) : t;
|
|
12
42
|
return f(e);
|
|
13
|
-
}
|
|
43
|
+
}
|
|
44
|
+
function N(t) {
|
|
45
|
+
return f(t) && t < 600 && t >= 100;
|
|
46
|
+
}
|
|
14
47
|
class i {
|
|
15
48
|
static isPresent(e, r) {
|
|
16
49
|
if (e == null)
|
|
@@ -28,84 +61,69 @@ class i {
|
|
|
28
61
|
throw new Error(r ?? "Unexpected value");
|
|
29
62
|
}
|
|
30
63
|
static createException(e, r) {
|
|
31
|
-
throw typeof e == "
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function l(t, e) {
|
|
35
|
-
if ([t, e].forEach((r, n) => {
|
|
36
|
-
if (!Number.isSafeInteger(r))
|
|
37
|
-
throw new Error(`${n === 0 ? "min" : "max"} is not a valid integer`);
|
|
38
|
-
}), e < t)
|
|
39
|
-
throw new Error("Min cannot be greater than max");
|
|
40
|
-
return t = Math.ceil(t), e = Math.floor(e), Math.floor(Math.random() * (e - t + 1)) + t;
|
|
41
|
-
}
|
|
42
|
-
class x {
|
|
43
|
-
static getRandom(e) {
|
|
44
|
-
return e[l(0, e.length - 1)];
|
|
45
|
-
}
|
|
46
|
-
static removeItem(e, r) {
|
|
47
|
-
const n = e.indexOf(r);
|
|
48
|
-
return n > -1 && e.splice(n, 1), e;
|
|
64
|
+
throw typeof e == "function" ? e() : new Error(e ?? r ?? "Assertion did not pass.");
|
|
49
65
|
}
|
|
50
66
|
}
|
|
51
67
|
function w() {
|
|
52
|
-
const t =
|
|
68
|
+
const t = u.createContext(void 0);
|
|
53
69
|
function e() {
|
|
54
|
-
const r =
|
|
70
|
+
const r = u.use(t);
|
|
55
71
|
if (r === void 0)
|
|
56
72
|
throw new Error("useCtx must be inside a Provider");
|
|
57
73
|
return r;
|
|
58
74
|
}
|
|
59
75
|
return [e, t.Provider];
|
|
60
76
|
}
|
|
61
|
-
function
|
|
62
|
-
const t =
|
|
77
|
+
function x() {
|
|
78
|
+
const t = u.createContext(void 0);
|
|
63
79
|
function e() {
|
|
64
|
-
const r =
|
|
80
|
+
const r = u.use(t);
|
|
65
81
|
return r === void 0 ? {} : r;
|
|
66
82
|
}
|
|
67
83
|
return [e, t.Provider];
|
|
68
84
|
}
|
|
85
|
+
function I(t) {
|
|
86
|
+
return t.split("/").reduceRight((n, o) => n.length === 0 && o === "" ? n : [o, ...n], []).join("/");
|
|
87
|
+
}
|
|
69
88
|
function p(t) {
|
|
70
89
|
return typeof t == "object" && t !== null && !Array.isArray(t);
|
|
71
90
|
}
|
|
72
91
|
function d(t, e, r) {
|
|
73
92
|
const n = Object.keys(t);
|
|
74
93
|
let o;
|
|
75
|
-
o
|
|
94
|
+
o ??= r;
|
|
76
95
|
for (const c of n) {
|
|
77
|
-
const
|
|
78
|
-
if (p(
|
|
96
|
+
const s = t[c];
|
|
97
|
+
if (p(s) && (o ??= d(s, e, o)), c === e)
|
|
79
98
|
return t[e];
|
|
80
99
|
}
|
|
81
100
|
return o;
|
|
82
101
|
}
|
|
83
|
-
|
|
102
|
+
function O(t, e) {
|
|
84
103
|
const r = t[e];
|
|
85
104
|
return r != null && typeof r == "object" && Object.prototype.hasOwnProperty.call(t, e) ? r : null;
|
|
86
|
-
}
|
|
87
|
-
function
|
|
105
|
+
}
|
|
106
|
+
function P(t) {
|
|
88
107
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
89
108
|
}
|
|
90
109
|
function j(t) {
|
|
91
|
-
return
|
|
110
|
+
return `I'm the @okam/shared-ui component telling ${t} !`;
|
|
92
111
|
}
|
|
93
|
-
const C = (t) => `I'm the @okam/shared-ui component telling ${t} !`;
|
|
94
112
|
export {
|
|
95
|
-
|
|
113
|
+
b as ArrayUtils,
|
|
96
114
|
i as Asserts,
|
|
97
|
-
|
|
98
|
-
|
|
115
|
+
P as capitalizeFirstLetter,
|
|
116
|
+
O as checkObjectProperty,
|
|
99
117
|
w as createCtx,
|
|
100
|
-
|
|
118
|
+
x as createCtxNullable,
|
|
101
119
|
d as getNestedObjectValueOfKey,
|
|
102
120
|
N as isHttpStatusCode,
|
|
103
121
|
h as isIsoDateString,
|
|
104
122
|
a as isNonEmptyString,
|
|
105
|
-
|
|
123
|
+
g as isParsableNumeric,
|
|
106
124
|
y as isParsableSafeInteger,
|
|
107
|
-
|
|
125
|
+
m as isPlainObject,
|
|
108
126
|
f as isSafeInteger,
|
|
109
|
-
|
|
110
|
-
|
|
127
|
+
I as normalizePath,
|
|
128
|
+
j as sayHello
|
|
111
129
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@okam/core-lib",
|
|
3
|
-
"version": "1.17.
|
|
4
|
-
"main": "./index.js",
|
|
5
|
-
"types": "./index.d.ts",
|
|
3
|
+
"version": "1.17.2",
|
|
6
4
|
"license": "MIT",
|
|
5
|
+
"repository": {
|
|
6
|
+
"url": "https://github.com/OKAMca/stack.git"
|
|
7
|
+
},
|
|
8
|
+
"sideEffects": false,
|
|
7
9
|
"exports": {
|
|
8
10
|
".": {
|
|
9
11
|
"import": {
|
|
@@ -16,22 +18,24 @@
|
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
},
|
|
21
|
+
"main": "./index.js",
|
|
22
|
+
"types": "./index.d.ts",
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=20.19.0"
|
|
25
|
+
},
|
|
19
26
|
"publishConfig": {
|
|
20
27
|
"access": "public"
|
|
21
28
|
},
|
|
22
|
-
"repository": {
|
|
23
|
-
"url": "https://github.com/OKAMca/stack.git"
|
|
24
|
-
},
|
|
25
29
|
"nxrelease": {
|
|
26
30
|
"repositoryUrl": "https://github.com/OKAMca/stack.git"
|
|
27
31
|
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
34
|
+
},
|
|
28
35
|
"dependencies": {
|
|
29
36
|
"@tsed/exceptions": "^8.3.1",
|
|
30
37
|
"dequal": "^2.0.3"
|
|
31
38
|
},
|
|
32
|
-
"peerDependencies": {
|
|
33
|
-
"react": "^18.0.0 || ^19.0.0"
|
|
34
|
-
},
|
|
35
39
|
"devDependencies": {
|
|
36
40
|
"react": "^19.0.0"
|
|
37
41
|
}
|
package/utils/array-utils.d.ts
CHANGED
package/utils/createContext.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import * as React from 'react';
|
|
3
2
|
/**
|
|
4
3
|
* A helper to create a Context and Provider with no upfront default value, and
|
|
5
4
|
* without having to check for undefined all the time.
|
|
6
5
|
*/
|
|
7
|
-
declare function createCtx<A extends
|
|
8
|
-
export declare function createCtxNullable<A extends
|
|
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>];
|
|
9
8
|
export default createCtx;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare function getNestedObjectValueOfKey<T>(obj: T & Record<string, unknown>, key: string, found?:
|
|
1
|
+
declare function getNestedObjectValueOfKey<T>(obj: T & Record<string, unknown>, key: string, found?: unknown): unknown;
|
|
2
2
|
export default getNestedObjectValueOfKey;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare
|
|
1
|
+
declare function checkObjectProperty(obj: Record<string, unknown>, property: string): Record<string, unknown> | null;
|
|
2
2
|
export default checkObjectProperty;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare class StringConvert {
|
|
2
|
-
static toSafeInteger: (value:
|
|
3
|
-
static toFloat: (value:
|
|
2
|
+
static toSafeInteger: (value: unknown) => number | null;
|
|
3
|
+
static toFloat: (value: unknown) => number | null;
|
|
4
4
|
}
|
package/utils/typeUtils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type Maybe<T> = T | null;
|
|
2
2
|
export declare function isNonNullable<T>(x: T): x is NonNullable<T>;
|
|
3
3
|
export declare function maybeWithDefault<T>(x: Maybe<T>, defaultValue: NonNullable<T>): NonNullable<T>;
|
|
4
|
-
export declare function unknownToString(str:
|
|
4
|
+
export declare function unknownToString(str: unknown): string;
|
package/utils/typeguards.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export type IsoDateString = string;
|
|
2
|
-
export declare
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
6
|
-
export declare
|
|
7
|
-
export declare
|
|
8
|
-
export declare
|
|
2
|
+
export declare function isIsoDateString(dateStr: unknown): dateStr is IsoDateString;
|
|
3
|
+
export declare function isNonEmptyString(v: unknown, trim?: boolean): v is string;
|
|
4
|
+
export declare function isPlainObject<T = unknown, K extends string | number = string>(v: unknown): v is Record<K, T>;
|
|
5
|
+
export declare function isSafeInteger(v: unknown): v is number;
|
|
6
|
+
export declare function isParsableNumeric(v: unknown): v is number | string;
|
|
7
|
+
export declare function isParsableSafeInteger(v: unknown): v is number | string;
|
|
8
|
+
export declare function isHttpStatusCode(v: unknown): v is number;
|