Skip to content

Commit 3d61c47

Browse files
Merge pull request #4 from angular-package/3.2.x
3.2.x
2 parents aebba52 + fb2a8bf commit 3d61c47

File tree

167 files changed

+6175
-1603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+6175
-1603
lines changed

README.md

Lines changed: 1331 additions & 385 deletions
Large diffs are not rendered by default.

packages/type/README.md

Lines changed: 1331 additions & 385 deletions
Large diffs are not rendered by default.

packages/type/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/type/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular-package/type",
3-
"version": "3.1.2",
3+
"version": "3.2.1",
44
"description": "Common types, type guards and type checkers.",
55
"author": "Angular Package <[email protected]> (https://wvvw.dev)",
66
"homepage": "https://github.com/angular-package/type#readme",

packages/type/src/guard/index.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1+
// `guard` object.
12
export { guard } from './lib/guard.object';
2-
3-
export { guardArray } from './lib/guard-array.func.type';
3+
// `guard` prefix functions,
4+
export { guardArray } from './lib/guard-array.func';
5+
export { guardBigInt } from './lib/guard-big-int.func';
6+
export { guardBoolean } from './lib/guard-boolean.func';
47
export { guardFunction } from './lib/guard-function.func';
8+
export { guardInstance } from './lib/guard-instance.func';
9+
export { guardKey } from './lib/guard-key.func';
510
export { guardNumber } from './lib/guard-number.func';
6-
export { guardObjectKey } from './lib/guard-object-key.func';
11+
export { guardNull } from './lib/guard-null.func';
712
export { guardObject } from './lib/guard-object.func';
13+
export { guardObjectKey } from './lib/guard-object-key.func';
814
export { guardPrimitive } from './lib/guard-primitive.func';
915
export { guardString } from './lib/guard-string.func';
16+
export { guardSymbol } from './lib/guard-symbol.func';
1017
export { guardType } from './lib/guard-type.func';
18+
export { guardUndefined } from './lib/guard-undefined.func';
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,33 @@
1-
21
import { GuardArray } from '../type/guard-array.type';
2+
import { GuardBigInt } from '../type/guard-big-int.type';
3+
import { GuardBoolean } from '../type/guard-boolean.type';
34
import { GuardFunction } from '../type/guard-function.type';
5+
import { GuardKey } from '../type/guard-key.type';
46
import { GuardNumber } from '../type/guard-number.type';
7+
import { GuardObject } from '../type/guard-object.type';
58
import { GuardObjectKey } from '../type/guard-object-key.type';
69
import { GuardPrimitive } from '../type/guard-primitive.type';
710
import { GuardString } from '../type/guard-string.type';
811
import { GuardType } from '../type/guard-type.type';
9-
import { GuardObject } from '../type/guard-object.type';
12+
import { GuardInstance } from '../type/guard-instance.type';
13+
import { GuardNull } from '../type/guard-null.type';
14+
import { GuardSymbol } from '../type/guard-symbol.type';
15+
import { GuardUndefined } from '../type/guard-undefined.type';
1016

1117
export interface GuardIs {
1218
array: GuardArray;
19+
bigint: GuardBigInt;
20+
boolean: GuardBoolean;
1321
function: GuardFunction;
14-
// TODO: Guard not
15-
// not: GuardNotIs;
22+
instance: GuardInstance;
23+
key: GuardKey;
24+
null: GuardNull;
1625
number: GuardNumber;
1726
object: GuardObject;
1827
objectKey: GuardObjectKey;
1928
primitive: GuardPrimitive;
2029
string: GuardString;
30+
symbol: GuardSymbol;
2131
type: GuardType;
32+
undefined: GuardUndefined;
2233
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Function.
2+
import { isArray } from '../../is/lib/is-array.func';
3+
// Type.
4+
import { GuardArray } from '../type/guard-array.type';
5+
import { ResultCallback } from '../../type/result-callback.type';
6+
/**
7+
* Guard the `value` to be an `Array` of a generic `Type`.
8+
* @param value A generic `Type` `Array` `value` to guard.
9+
* @param callback Optional `ResultCallback` function to handle result before returns.
10+
* @returns A `boolean` indicating whether or not the `value` is an `Array` of a generic `Type`.
11+
*/
12+
export const guardArray: GuardArray = <Type>(value: Array<Type>, callback?: ResultCallback): value is Array<Type> =>
13+
isArray<Type>(value, callback);

packages/type/src/guard/lib/guard-array.func.type.ts

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Function.
2+
import { isBigInt } from '../../is/lib/is-big-int.func';
3+
// Type.
4+
import { GuardBigInt } from '../type/guard-big-int.type';
5+
import { ResultCallback } from '../../type/result-callback.type';
6+
/**
7+
* Guard the `value` to be a `bigint`.
8+
* @param value A `bigint` type `value` to guard.
9+
* @param callback Optional `ResultCallback` function to handle result before returns.
10+
* @returns A `boolean` indicating whether or not the `value` is a `bigint`.
11+
*/
12+
export const guardBigInt: GuardBigInt = (value: bigint, callback?: ResultCallback): value is bigint =>
13+
isBigInt(value, callback);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Function.
2+
import { isBoolean } from '../../is/lib/is-boolean.func';
3+
// Type.
4+
import { GuardBoolean } from '../type/guard-boolean.type';
5+
import { ResultCallback } from '../../type/result-callback.type';
6+
/**
7+
* Guard the `value` to be a `boolean`.
8+
* @param value A `boolean` type `value` to guard.
9+
* @param callback Optional `ResultCallback` function to handle result before returns.
10+
* @returns A `boolean` indicating whether or not the `value` is a `boolean`.
11+
*/
12+
export const guardBoolean: GuardBoolean = (value: boolean, callback?: ResultCallback): value is boolean =>
13+
isBoolean(value, callback);

0 commit comments

Comments
 (0)