Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 52 additions & 29 deletions README.md

Large diffs are not rendered by default.

81 changes: 52 additions & 29 deletions packages/type/README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/type/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/type/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@angular-package/type",
"version": "4.0.1",
"version": "4.0.2",
"description": "Common types, type guards and type checkers.",
"author": "Angular Package <angular-package@wvvw.dev> (https://wvvw.dev)",
"homepage": "https://github.com/angular-package/type#readme",
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/lib/guard-object-key.func.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ import { ResultCallback } from '../../type/result-callback.type';
* @returns A `boolean` indicating whether or not the `value` is an `object` of a generic `Obj` containing the `key`.
*/
export const guardObjectKey: GuardObjectKey =
<Obj extends object>(value: Obj, key: keyof Obj | (keyof Obj)[], callback?: ResultCallback): value is Obj =>
<Obj = object>(value: Obj, key: keyof Obj | (keyof Obj)[], callback?: ResultCallback): value is Obj =>
isObjectKey<Obj>(value, key, callback);
2 changes: 1 addition & 1 deletion packages/type/src/guard/lib/guard-object.func.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ import { ResultCallback } from '../../type/result-callback.type';
* @param callback An optional `ResultCallback` function to handle result before returns.
* @returns A `boolean` indicating whether or not the `value` is an `object` of a generic `Obj`.
*/
export const guardObject: GuardObject = <Obj extends object>(value: Obj, callback?: ResultCallback): value is Obj =>
export const guardObject: GuardObject = <Obj = object>(value: Obj, callback?: ResultCallback): value is Obj =>
isObject<Obj>(value, callback);
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-boolean.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe(guardBoolean.name, () => {
it('is DEFINED', () => expect(guardBoolean).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardBoolean(TRUE, (result: boolean, value: boolean) => {
expect(result).toBe(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-defined.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe(guardDefined.name, () => {
it('is DEFINED', () => expect(guardDefined).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardDefined(UNDEFINED, (result: boolean, value: undefined) => {
expect(result).toBe(FALSE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-instance.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe(guardInstance.name , () => {
it('is DEFINED', () => expect(guardInstance).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardInstance(CLASS, Class, (result: boolean, value: Class) => {
expect(result).toBe(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-key.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe(guardKey.name, () => {
it('is DEFINED', () => expect(guardKey).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardKey(STRING, (result: boolean, value: Key) => {
expect(result).toBe(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-null.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe(guardNull.name, () => {
it('is DEFINED', () => expect(guardNull).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardNull(NULL, (result: boolean, value: null) => {
expect(result).toBe(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-number.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe(guardNumber.name, () => {
it('is DEFINED', () => expect(guardNumber).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardNumber(NUMBER, (result: boolean, value: number) => {
expect(result).toBe(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-object-key.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe(guardObjectKey.name , () => {
it('is DEFINED', () => expect(guardObjectKey).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardObjectKey<TestClass>(TEST_CLASS, ['firstName', 'surname'], (result: boolean, value: TestClass) => {
expect(result).toBe(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-object.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe(guardObject.name, () => {
it('is DEFINED', () => expect(guardObject).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardObject(OBJECT_ONE, (result: boolean, value: any) => {
expect(result).toBe(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-primitive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe(guardPrimitive.name, () => {
it('is DEFINED', () => expect(guardPrimitive).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardPrimitive<string>(STRING, 'string' , (result: boolean, value: string) => {
expect(result).toBe(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-string.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe(guardString.name, () => {
it('is DEFINED', () => expect(guardString).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardString(STRING, (result: boolean, value: string) => {
expect(result).toBe(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-symbol.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe(guardSymbol.name, () => {
it('is DEFINED', () => expect(guardSymbol).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardSymbol(SYMBOL_STRING, (result: boolean, value: symbol) => {
expect(result).toBe(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/test/guard-undefined.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe(guardUndefined.name, () => {
it('is DEFINED', () => expect(guardUndefined).toBeDefined());

// Checks ...
describe(`checks`, () => {
describe(`guards`, () => {
it('callback', () => {
guardUndefined(UNDEFINED, (result: boolean, value: undefined) => {
expect(result).toBe(TRUE);
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/guard/type/guard-object-key.type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ResultCallback } from '../../type/result-callback.type';
export type GuardObjectKey = <Obj extends object>(value: Obj, key: keyof Obj | (keyof Obj)[], callback?: ResultCallback) => value is Obj;
export type GuardObjectKey = <Obj = object>(value: Obj, key: keyof Obj | (keyof Obj)[], callback?: ResultCallback) => value is Obj;


2 changes: 1 addition & 1 deletion packages/type/src/guard/type/guard-object.type.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import { ResultCallback } from '../../type/result-callback.type';
export type GuardObject = <Obj extends object>(value: Obj, callback?: ResultCallback) => value is Obj;
export type GuardObject = <Obj = object>(value: Obj, callback?: ResultCallback) => value is Obj;
2 changes: 1 addition & 1 deletion packages/type/src/is/lib/is-object-key-in.func.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ResultCallback } from '../../type/result-callback.type';
* @callback `resultCallback`.
* @returns A `boolean` indicating whether or not the `value` is an `object` with the keys.
*/
export const isObjectKeyIn: IsObjectKeyIn = <Type extends object>(
export const isObjectKeyIn: IsObjectKeyIn = <Type = object>(
value: any,
key: Key | Key[],
callback: ResultCallback = resultCallback
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/is/lib/is-object-key.func.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ResultCallback } from '../../type/result-callback.type';
* @callback `resultCallback`.
* @returns A `boolean` indicating whether or not the `value` is an `object` with its own specified keys.
*/
export const isObjectKey: IsObjectKey = <Type extends object>(
export const isObjectKey: IsObjectKey = <Type = object>(
value: any,
key: Key | Key[],
callback: ResultCallback = resultCallback
Expand Down
2 changes: 1 addition & 1 deletion packages/type/src/is/type/is-object-key-in.type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { Key } from '../../type/key.type';
import { ResultCallback } from '../../type/result-callback.type';
export type IsObjectKeyIn = <Type extends object>(value: any, key: Key | Key[], callback?: ResultCallback) => value is Type;
export type IsObjectKeyIn = <Type = object>(value: any, key: Key | Key[], callback?: ResultCallback) => value is Type;
2 changes: 1 addition & 1 deletion packages/type/src/is/type/is-object-key.type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { Key } from '../../type/key.type';
import { ResultCallback } from '../../type/result-callback.type';
export type IsObjectKey = <Type extends object>(value: any, key: Key | Key[], callback?: ResultCallback) => value is Type;
export type IsObjectKey = <Type = object>(value: any, key: Key | Key[], callback?: ResultCallback) => value is Type;