@candlerip/shared3 0.0.98 → 0.0.100
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/ssr/server-side-props/candles-page-server-side-props.type.d.ts +2 -0
- package/src/type/index.d.ts +1 -0
- package/src/type/index.js +1 -0
- package/src/type/is-null/index.d.ts +1 -0
- package/src/type/is-null/index.js +1 -0
- package/src/type/object/index.d.ts +1 -0
- package/src/type/object/index.js +1 -0
- package/src/type/object/is-object/index.d.ts +3 -0
- package/src/type/object/is-object/index.js +3 -0
- package/src/type/object/is-object/object/index.d.ts +1 -0
- package/src/type/object/is-object/object/index.js +11 -0
- package/src/type/object/is-object/properties-in-object/index.d.ts +1 -0
- package/src/type/object/is-object/properties-in-object/index.js +8 -0
- package/src/type/object/is-object/property-in-object/index.d.ts +1 -0
- package/src/type/object/is-object/property-in-object/index.js +13 -0
package/package.json
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
import { Auth } from '../../auth/index.js';
|
2
2
|
import { CookieConsent } from '../../cookie/index.js';
|
3
3
|
import { Dictionary, Language } from '../../dictionary/index.js';
|
4
|
+
import { CandleFilterSort } from '../../filter-sort/index.js';
|
4
5
|
import { CandlesPageData } from '../../page/index.js';
|
5
6
|
export interface CandlesPageServerSideProps {
|
6
7
|
auth: Auth;
|
7
8
|
cookieConsent?: CookieConsent;
|
8
9
|
dictionary: Dictionary;
|
10
|
+
filterSort: CandleFilterSort;
|
9
11
|
language: Language;
|
10
12
|
pageData: CandlesPageData;
|
11
13
|
}
|
package/src/type/index.d.ts
CHANGED
package/src/type/index.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export declare const isNull: (data?: unknown) => data is null;
|
@@ -0,0 +1 @@
|
|
1
|
+
export const isNull = (data) => data === null;
|
package/src/type/object/index.js
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
export declare const isObject: (data?: unknown) => data is Record<string, unknown>;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { isArray } from '../../../array/index.js';
|
2
|
+
import { isNull } from '../../../is-null/index.js';
|
3
|
+
export const isObject = (data) => {
|
4
|
+
if (typeof data !== 'object') {
|
5
|
+
return false;
|
6
|
+
}
|
7
|
+
if (isNull(data)) {
|
8
|
+
return false;
|
9
|
+
}
|
10
|
+
return !isArray(data);
|
11
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const isPropertiesInObject: <X extends string, T>(props: X[], data?: unknown, typeGuard?: (data?: unknown) => data is T) => data is { [key in X]: T; };
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { isObject } from '../object/index.js';
|
2
|
+
import { isPropertyInObject } from '../property-in-object/index.js';
|
3
|
+
export const isPropertiesInObject = (props, data, typeGuard) => {
|
4
|
+
if (!isObject(data)) {
|
5
|
+
return false;
|
6
|
+
}
|
7
|
+
return props.every((a) => isPropertyInObject(a, data, typeGuard));
|
8
|
+
};
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const isPropertyInObject: <X extends string, T>(prop: X, data?: unknown, typeGuard?: (data?: unknown) => data is T) => data is Record<X, T>;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { isObject } from '../object/index.js';
|
2
|
+
export const isPropertyInObject = (prop, data, typeGuard) => {
|
3
|
+
if (!isObject(data)) {
|
4
|
+
return false;
|
5
|
+
}
|
6
|
+
if (!(prop in data)) {
|
7
|
+
return false;
|
8
|
+
}
|
9
|
+
if (typeGuard && !typeGuard(data[prop])) {
|
10
|
+
return false;
|
11
|
+
}
|
12
|
+
return true;
|
13
|
+
};
|