Skip to content

Commit

Permalink
style: replace substring expressions with RegEx
Browse files Browse the repository at this point in the history
Co-authored-by: chris48s <[email protected]>
  • Loading branch information
cyb3rko and chris48s authored Jan 5, 2025
1 parent 78667b9 commit 6358dc2
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions services/mastodon/mastodon-follow.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ export default class MastodonFollow extends BaseJsonService {
async handle({ id }, { domain = 'mastodon.social' }) {
if (isNaN(id))
throw new NotFound({ prettyMessage: 'invalid user id format' })
if (domain.startsWith('https://')) {
domain = domain.substring(8)
} else if (domain.startsWith('http://')) {
domain = domain.substring(7)
}
domain = domain.replace(/^https?:\/\//, '')
const data = await this.fetch({ id, domain })
return this.constructor.render({
username: data.username,
Expand Down

0 comments on commit 6358dc2

Please sign in to comment.