Skip to content

Add option to preserve username case in zod-transform-socials (GitHub/Twitter/AO3) #49

Description

@essential-randomness

zod-transform-socials lower-cases the whole URL before matching, which means usernames are also lower-cased for services that preserve case. For example, github.com/FujoWebDev/AO3.js is reported as fujowebdev/ao3.js.

Lower-casing is needed for host detection (so BSKY.APP matches bsky.app), but it should not apply to the username (or at least, it should be an option not to apply it).

Among services affected:

  • GitHub— org and repo names preserve case.
  • Twitter/X — handle display preserves case.
  • AO3 — usernames and pseuds preserve case.
  • NPM is affected in that older package names could be uppercase/lowercase, but now they're all lowercase. With that said, the install is case sensitive.

This changes observable output, so it is a breaking change. We could mitigate it by adding a preserveCase setting and/or a canonicalCase option for known addresses that one may want to keep consistent. We could also consider exporting convenience methods like "isSameProfile".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions