Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: export async tracker, checklist
- Loading branch information
Showing
15 changed files
with
215 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [Checklist](./js-utils.checklist.md) > [(constructor)](./js-utils.checklist._constructor_.md) | ||
|
||
## Checklist.(constructor) | ||
|
||
Constructs a new instance of the `Checklist` class | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
constructor(options: ChecklistOptions<T>); | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| options | <code>ChecklistOptions<T></code> | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [Checklist](./js-utils.checklist.md) > [check](./js-utils.checklist.check.md) | ||
|
||
## Checklist.check() method | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
check(value: T): boolean; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| value | <code>T</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`boolean` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [Checklist](./js-utils.checklist.md) > [data](./js-utils.checklist.data.md) | ||
|
||
## Checklist.data property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly data: Array<T>; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [Checklist](./js-utils.checklist.md) | ||
|
||
## Checklist class | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare class Checklist<T> implements ChecklistOptions<T> | ||
``` | ||
## Constructors | ||
| Constructor | Modifiers | Description | | ||
| --- | --- | --- | | ||
| [(constructor)(options)](./js-utils.checklist._constructor_.md) | | Constructs a new instance of the <code>Checklist</code> class | | ||
## Properties | ||
| Property | Modifiers | Type | Description | | ||
| --- | --- | --- | --- | | ||
| [data](./js-utils.checklist.data.md) | | <code>Array<T></code> | | | ||
| [mode](./js-utils.checklist.mode.md) | | <code>ChecklistMode</code> | | | ||
## Methods | ||
| Method | Modifiers | Description | | ||
| --- | --- | --- | | ||
| [check(value)](./js-utils.checklist.check.md) | | | | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [Checklist](./js-utils.checklist.md) > [mode](./js-utils.checklist.mode.md) | ||
|
||
## Checklist.mode property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
readonly mode: ChecklistMode; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [ChecklistMode](./js-utils.checklistmode.md) | ||
|
||
## ChecklistMode enum | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare enum ChecklistMode | ||
``` | ||
|
||
## Enumeration Members | ||
|
||
| Member | Value | Description | | ||
| --- | --- | --- | | ||
| EXCLUDE | <code>"exclude"</code> | | | ||
| INCLUDE | <code>"include"</code> | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [ChecklistOptions](./js-utils.checklistoptions.md) > [data](./js-utils.checklistoptions.data.md) | ||
|
||
## ChecklistOptions.data property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
data: Array<T>; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [ChecklistOptions](./js-utils.checklistoptions.md) | ||
|
||
## ChecklistOptions interface | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface ChecklistOptions<T> | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [data](./js-utils.checklistoptions.data.md) | <code>Array<T></code> | | | ||
| [mode](./js-utils.checklistoptions.mode.md) | <code>ChecklistMode</code> | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [ChecklistOptions](./js-utils.checklistoptions.md) > [mode](./js-utils.checklistoptions.mode.md) | ||
|
||
## ChecklistOptions.mode property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
mode: ChecklistMode; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { expect } from 'chai'; | ||
|
||
import { Checklist, ChecklistMode } from '../../src/utils/Checklist'; | ||
import { describeLeaks, itLeaks } from '../helpers/async'; | ||
|
||
const EXISTING_ITEM = 'foo'; | ||
const MISSING_ITEM = 'bin'; | ||
const TEST_DATA = [EXISTING_ITEM, 'bar']; | ||
|
||
// tslint:disable:no-duplicate-functions | ||
describeLeaks('checklist', async () => { | ||
describeLeaks('exclude mode', async () => { | ||
itLeaks('should check for present values', async () => { | ||
const list = new Checklist({ | ||
data: TEST_DATA, | ||
mode: ChecklistMode.EXCLUDE, | ||
}); | ||
expect(list.check(EXISTING_ITEM)).to.equal(false); | ||
}); | ||
|
||
itLeaks('should check for missing values', async () => { | ||
const list = new Checklist({ | ||
data: TEST_DATA, | ||
mode: ChecklistMode.EXCLUDE, | ||
}); | ||
expect(list.check(MISSING_ITEM)).to.equal(true); | ||
}); | ||
}); | ||
|
||
describeLeaks('include mode', async () => { | ||
itLeaks('should check for present values', async () => { | ||
const list = new Checklist<string>({ | ||
data: TEST_DATA, | ||
mode: ChecklistMode.INCLUDE, | ||
}); | ||
expect(list.check(EXISTING_ITEM)).to.equal(true); | ||
}); | ||
|
||
itLeaks('should check for missing values', async () => { | ||
const list = new Checklist<string>({ | ||
data: TEST_DATA, | ||
mode: ChecklistMode.INCLUDE, | ||
}); | ||
expect(list.check(MISSING_ITEM)).to.equal(false); | ||
}); | ||
}); | ||
}); |