Skip to content

Commit

Permalink
feat(CV-320): added Iterable type parameter to guardIterable
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-jonathan committed Sep 27, 2023
1 parent 06cd68f commit 7273dbd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
27 changes: 15 additions & 12 deletions 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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cosmicmind/foundationjs",
"version": "0.0.1-rc-092623-1",
"version": "0.0.1-rc-092723-1",
"description": "A library of helpful tools for developing projects in TypeScript.",
"keywords": [],
"author": {
Expand Down
2 changes: 1 addition & 1 deletion src/guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function guard<T>(data: unknown, ...keys: (keyof T)[]): data is T {
return validate<T>(data as T, ...keys)
}

export function guardIterator<T>(data: unknown, ...keys: (keyof T)[]): data is T {
export function guardIterator<T>(data: Iterable<T>, ...keys: (keyof T)[]): data is Iterable<T> {
if (guard<Generator<InferArrayType<T>>>(data) && typeof data[Symbol.iterator] === 'function') {
for (const x of data) {
if (!validate<T>(x, ...keys)) {
Expand Down

0 comments on commit 7273dbd

Please sign in to comment.