Skip to content

Conversation

@grypez
Copy link
Contributor

@grypez grypez commented Oct 1, 2024

Adds some abstract type guards to @ocap/utils.

  • isPrimitive checks that a value is a string, number, bigint, boolean, symbol, null or undefined
  • isTypedArray checks that a value is an array such that every element passes the supplied type guard
  • isTypedObject checks that a value is an object such that every value passes the supplied type guard

The container type guards pass trivially on empty arrays and objects with no values.

@grypez grypez requested a review from a team as a code owner October 1, 2024 21:04
sirtimid
sirtimid previously approved these changes Oct 3, 2024
Copy link
Contributor

@sirtimid sirtimid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!

@grypez grypez force-pushed the grypez/structured-types branch from 54a0c2b to 0d2d329 Compare October 3, 2024 18:44
@grypez grypez merged commit c2e9ddd into main Oct 3, 2024
@grypez grypez deleted the grypez/structured-types branch October 3, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants