Skip to content

Commit b7ce020

Browse files
Merge pull request #22 from angular-package/4.1.x
4.1.1
2 parents ce1a523 + 9dd0c64 commit b7ce020

File tree

91 files changed

+1028
-196
lines changed

Some content is hidden

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

91 files changed

+1028
-196
lines changed

README.md

Lines changed: 123 additions & 60 deletions
Large diffs are not rendered by default.

package-lock.json

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

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
{
22
"name": "@angular-package/type",
3-
"version": "4.1.0",
3+
"version": "4.1.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",
77
"peerDependencies": {},
8+
"devDependencies": {
9+
"tslint": "^6.1.3"
10+
},
811
"dependencies": {
912
"tslib": "^2.1.0"
1013
},

src/guard/lib/guard-instance.func.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ import { Constructor } from '../../type/constructor.type';
55
import { GuardInstance } from '../type/guard-instance.type';
66
import { ResultCallback } from '../../type/result-callback.type';
77
/**
8-
* Guard the `value` to guard the `value` to be an `object` of a generic `Obj` type equal to an `instance`.
9-
* @param value An `Obj` type `value` to compare with the `instance`.
10-
* @param instance A generic `Obj` `Constructor` type to create an `instance` to compare with the `value`.
11-
* @param callback Optional `ResultCallback` function to handle result before returns.
12-
* @returns A `boolean` indicating whether or not the `value` is a `symbol`.
8+
* Guard the `value` to be an `object` of a generic `Obj` type and an instance of `Constructor` type.
9+
* @param value A generic `Obj` type `value` to be an instance of the `constructor`.
10+
* @param constructor A class or function that specifies the type of the `constructor`.
11+
* @param callback An optional `ResultCallback` function to handle the result before returns.
12+
* @returns A `boolean` indicating whether or not the `value` is an `instance` of a generic `Obj`.
1313
*/
14-
export const guardInstance: GuardInstance = <Obj extends object>(value: Obj, instance: Constructor<Obj>, callback?: ResultCallback): value is Obj =>
15-
isInstance<Obj>(value, instance, callback);
14+
export const guardInstance: GuardInstance =
15+
<Obj extends object>(value: Obj, constructor: Constructor<Obj>, callback?: ResultCallback): value is Obj =>
16+
isInstance<Obj>(value, constructor, callback);

src/guard/test/guard-array.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Function.
22
import { guardArray } from '../lib/guard-array.func';
3-
// Variables.
3+
// Constant.
44
import {
55
ARRAY_BIGINT,
66
ARRAY_BOOLEAN,

src/guard/test/guard-bigint.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Function.
22
import { guardBigInt } from '../lib/guard-big-int.func';
3-
// Variables.
3+
// Constant.
44
import { BIGINT, BIGINT_EXPECTATION, BIGINT_INSTANCE } from '../../testing/variables/strict/big-int.const';
55
import { TRUE } from '../../testing/variables/strict/boolean.const';
66

src/guard/test/guard-boolean.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Function.
22
import { guardBoolean } from '../lib/guard-boolean.func';
3-
// Variables.
3+
// Constant.
44
import { FALSE_EXPECTATION, TRUE, TRUE_EXPECTATION, FALSE, TRUE_INSTANCE, FALSE_INSTANCE } from '../../testing/variables/strict/boolean.const';
55

66
describe(guardBoolean.name, () => {

src/guard/test/guard-class.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
import { guard } from '../lib/guard.object';
33
// Function.
44
import { guardClass } from '../lib/guard-class.func';
5-
// Variables.
6-
import { Person } from '../../testing/variables/strict/class.const';
5+
// Constant.
6+
import { Persons } from '../../testing/variables/strict/class.const';
77
import { TRUE } from '../../testing/variables/strict/boolean.const';
88

99
describe(guardClass.name, () => {
1010
// TRUE
1111
it('is DEFINED', () => expect(guardClass).toBeDefined());
12-
it(`Class`, () => expect(guardClass(Person)).toBe(TRUE));
13-
it(`Class`, () => expect(guard.is.class(Person)).toBe(TRUE));
12+
it(`Class`, () => {
13+
expect(guardClass(Persons)).toBe(TRUE);
14+
expect(guard.is.class(Persons)).toBe(TRUE);
15+
});
1416
});

src/guard/test/guard-defined.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Function.
22
import { guardDefined } from '../lib/guard-defined.func';
3-
// Variables.
3+
// Constant.
44
import { STRING } from '../../testing/variables/strict/string.const';
55
import { TRUE } from '../../testing/variables/strict/boolean.const';
66

src/guard/test/guard-function.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Function.
22
import { guardFunction } from '../lib/guard-function.func';
3-
// Variables.
3+
// Constant.
44
import { FUNCTION } from '../../testing/variables/function.const';
55

66
describe(guardFunction.name, () => {

0 commit comments

Comments
 (0)