-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f78e4e5
commit 7c7b236
Showing
7 changed files
with
24 additions
and
24 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
packages/components/src/utils/property-checkers/check-contains-only.ts
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export function checkContainsOnly<T = unknown>(array: T[], test: (item: T) => boolean, errorMessage: string) { | ||
if (array.length && !array.every(test)) throw new Error(errorMessage); | ||
export function checkContainsOnly<T = unknown>(array: T[], test: (item: T) => boolean, error: string) { | ||
if (array.length && !array.every(test)) throw new Error(error); | ||
} |
4 changes: 2 additions & 2 deletions
4
packages/components/src/utils/property-checkers/check-exists.ts
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export function checkExists<T = unknown>(value: T, errorMessage: string) { | ||
export function checkExists<T = unknown>(value: T, error: string) { | ||
const valueIsUndefined = typeof value === 'undefined'; | ||
const valueIsNull = value === null; | ||
const valueIsNaN = typeof value === 'number' && isNaN(value); | ||
|
||
if (valueIsUndefined || valueIsNull || valueIsNaN) throw new Error(errorMessage); | ||
if (valueIsUndefined || valueIsNull || valueIsNaN) throw new Error(error); | ||
} |
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
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