Skip to content

Commit b1f9562

Browse files
docs(README.md): update
1 parent c696515 commit b1f9562

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ npm i --save @angular-package/type
193193

194194
## Callback
195195

196+
![update][update]
197+
196198
Default function to handle `callback`.
197199

198200
```typescript
@@ -209,9 +211,9 @@ The **return value** is a `boolean` type result from the check.
209211
Custom function to handle `callback`.
210212

211213
```typescript
212-
const customCallback: ResultCallback = (result: boolean): boolean => {
214+
const customCallback: ResultCallback = (result: boolean, value: any): boolean => {
213215
if (result === false) {
214-
throw new Error('error');
216+
throw new Error(`${value} must be a string`);
215217
}
216218
return result;
217219
};
@@ -1708,7 +1710,7 @@ const guardUndefined: GuardUndefined = (value: undefined, callback?: ResultCallb
17081710
| Parameter | Type | Description |
17091711
| :-------- | :---------------------------------: | :---------------------------------- |
17101712
| value | `undefined` | A `undefined` type `value` to guard |
1711-
| callback | [`ResultCallback`][resultcallback] | Optional [`ResultCallback`][resultcallback] function to handle result before returns eg. to throw an `Error` |
1713+
| callback | [`ResultCallback`][resultcallback] | Optional [`ResultCallback`][resultcallback] function to handle result before returns eg. to throw an `Error` |
17121714

17131715
The **return value** is a `boolean` indicating whether or not the `value` is `undefined`.
17141716

@@ -2007,7 +2009,7 @@ type Primitives = 'bigint' | 'boolean' | 'null' | 'number' | 'symbol' | 'string'
20072009
### ResultCallback
20082010

20092011
```typescript
2010-
type ResultCallback = (result: boolean) => boolean;
2012+
type ResultCallback = <Obj>(result: boolean, value?: any) => boolean;
20112013
```
20122014

20132015
### Type

packages/type/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ npm i --save @angular-package/type
193193

194194
## Callback
195195

196+
![update][update]
197+
196198
Default function to handle `callback`.
197199

198200
```typescript
@@ -209,9 +211,9 @@ The **return value** is a `boolean` type result from the check.
209211
Custom function to handle `callback`.
210212

211213
```typescript
212-
const customCallback: ResultCallback = (result: boolean): boolean => {
214+
const customCallback: ResultCallback = (result: boolean, value: any): boolean => {
213215
if (result === false) {
214-
throw new Error('error');
216+
throw new Error(`${value} must be a string`);
215217
}
216218
return result;
217219
};
@@ -1708,7 +1710,7 @@ const guardUndefined: GuardUndefined = (value: undefined, callback?: ResultCallb
17081710
| Parameter | Type | Description |
17091711
| :-------- | :---------------------------------: | :---------------------------------- |
17101712
| value | `undefined` | A `undefined` type `value` to guard |
1711-
| callback | [`ResultCallback`][resultcallback] | Optional [`ResultCallback`][resultcallback] function to handle result before returns eg. to throw an `Error` |
1713+
| callback | [`ResultCallback`][resultcallback] | Optional [`ResultCallback`][resultcallback] function to handle result before returns eg. to throw an `Error` |
17121714

17131715
The **return value** is a `boolean` indicating whether or not the `value` is `undefined`.
17141716

@@ -2007,7 +2009,7 @@ type Primitives = 'bigint' | 'boolean' | 'null' | 'number' | 'symbol' | 'string'
20072009
### ResultCallback
20082010

20092011
```typescript
2010-
type ResultCallback = (result: boolean) => boolean;
2012+
type ResultCallback = <Obj>(result: boolean, value?: any) => boolean;
20112013
```
20122014

20132015
### Type

0 commit comments

Comments
 (0)