Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieusieben committed Dec 2, 2024
1 parent 617d86c commit 2714235
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 35 deletions.
8 changes: 1 addition & 7 deletions packages/api/src/client/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ function check$type<Id extends string, Hash extends string>(
): $type is $Type<Id, Hash> {
return (
typeof $type === 'string' &&
($type === id
? hash === 'main'
: // $type === `${id}#${hash}`
$type.length === id.length + 1 + hash.length &&
$type[id.length] === '#' &&
$type.startsWith(id) &&
$type.endsWith(hash))
($type === id ? hash === 'main' : $type === `${id}#${hash}`)
)
}

Expand Down
8 changes: 1 addition & 7 deletions packages/bsky/src/lexicon/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ function check$type<Id extends string, Hash extends string>(
): $type is $Type<Id, Hash> {
return (
typeof $type === 'string' &&
($type === id
? hash === 'main'
: // $type === `${id}#${hash}`
$type.length === id.length + 1 + hash.length &&
$type[id.length] === '#' &&
$type.startsWith(id) &&
$type.endsWith(hash))
($type === id ? hash === 'main' : $type === `${id}#${hash}`)
)
}

Expand Down
8 changes: 1 addition & 7 deletions packages/lex-cli/src/codegen/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,7 @@ function check$type<Id extends string, Hash extends string>(
): $type is $Type<Id, Hash> {
return (
typeof $type === 'string' &&
($type === id
? hash === 'main'
: // $type === \`\${id}#\${hash}\`
$type.length === id.length + 1 + hash.length &&
$type[id.length] === '#' &&
$type.startsWith(id) &&
$type.endsWith(hash))
($type === id ? hash === 'main' : $type === \`\${id}#\${hash}\`)
)
}
Expand Down
8 changes: 1 addition & 7 deletions packages/ozone/src/lexicon/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ function check$type<Id extends string, Hash extends string>(
): $type is $Type<Id, Hash> {
return (
typeof $type === 'string' &&
($type === id
? hash === 'main'
: // $type === `${id}#${hash}`
$type.length === id.length + 1 + hash.length &&
$type[id.length] === '#' &&
$type.startsWith(id) &&
$type.endsWith(hash))
($type === id ? hash === 'main' : $type === `${id}#${hash}`)
)
}

Expand Down
8 changes: 1 addition & 7 deletions packages/pds/src/lexicon/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ function check$type<Id extends string, Hash extends string>(
): $type is $Type<Id, Hash> {
return (
typeof $type === 'string' &&
($type === id
? hash === 'main'
: // $type === `${id}#${hash}`
$type.length === id.length + 1 + hash.length &&
$type[id.length] === '#' &&
$type.startsWith(id) &&
$type.endsWith(hash))
($type === id ? hash === 'main' : $type === `${id}#${hash}`)
)
}

Expand Down

0 comments on commit 2714235

Please sign in to comment.