The input to be processed. Can be of any type, but the function is designed to work with strings that represent DID verification method identifiers.
The fragment part of the DID identifier if the input is a string containing a '#'. Returns an empty string for all other inputs, including non-string types, strings without a '#', and complex data structures.
console.log(extractDidFragment("did:example:123#key-1")); // Output: "key-1"
console.log(extractDidFragment("did:example:123")); // Output: undefined
console.log(extractDidFragment({ id: "did:example:123#0", type: "JsonWebKey" })); // Output: undefined
console.log(extractDidFragment(undefined)); // Output: undefined
Extracts the fragment part of a Decentralized Identifier (DID) verification method identifier.
This function takes any input and aims to return only the fragment of a DID identifier, which comes after the '#' symbol in a DID string. It's designed specifically for handling DID verification method identifiers. The function returns undefined for non-string inputs, inputs that do not contain a '#', or complex data structures like objects or arrays, ensuring that only the fragment part of a DID string is extracted when present.