Skip to content

Commit 61e9376

Browse files
refactor(guard): add possibility to use is prefixed functions directly from the guard eg. guard.array()
1 parent 21f3f48 commit 61e9376

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import { GuardIs } from './guard-is.interface';
2-
export interface Guard {
2+
export interface Guard extends GuardIs {
33
is: GuardIs;
44
}

src/guard/interface/guard-is.interface.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Import: Type.
12
import { GuardArray } from '../type/guard-array.type';
23
import { GuardBigInt } from '../type/guard-big-int.type';
34
import { GuardBoolean } from '../type/guard-boolean.type';
@@ -16,7 +17,7 @@ import { GuardInstance } from '../type/guard-instance.type';
1617
import { GuardNull } from '../type/guard-null.type';
1718
import { GuardSymbol } from '../type/guard-symbol.type';
1819
import { GuardUndefined } from '../type/guard-undefined.type';
19-
20+
// Export: Interface.
2021
export interface GuardIs {
2122
array: GuardArray;
2223
bigint: GuardBigInt;
@@ -30,7 +31,7 @@ export interface GuardIs {
3031
number: GuardNumber;
3132
object: GuardObject;
3233
objectKey: GuardObjectKey;
33-
objectKeys: GuardObjectKeys,
34+
objectKeys: GuardObjectKeys;
3435
primitive: GuardPrimitive;
3536
string: GuardString;
3637
symbol: GuardSymbol;

src/guard/lib/guard.object.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
// Object.
1+
// Import: Object.
22
import { guardIs } from './guard-is.object';
3-
// Interface.
3+
// Import: Interface.
44
import { Guard } from '../interface/guard-interface';
5-
// `guard`
6-
export const guard: Guard = {
7-
is: guardIs
8-
};
5+
// Export: `guard`
6+
export const guard: Guard = { ...guardIs, is: guardIs };

0 commit comments

Comments
 (0)