A generic hook that generates a consistent key based on input arguments.
Originally created for the purpose of generating consistent cache keys, this hook can be used
in any scenario where you need a normalized key. It takes two arguments: arg1 and arg2,
and returns a consistent key regardless of the order in which the arguments are passed.
The hook identifies one argument as an "identifier" and the other as a "prefix".
The identifier is normalized by removing spaces, converting it to lowercase, and stripping
non-alphanumeric characters. The key is then returned in the format: prefix-identifier-key.
If either argument is undefined or cannot be determined, the hook returns undefined.
A generic hook that generates a consistent key based on input arguments.
Originally created for the purpose of generating consistent cache keys, this hook can be used in any scenario where you need a normalized key. It takes two arguments:
arg1
andarg2
, and returns a consistent key regardless of the order in which the arguments are passed.The hook identifies one argument as an "identifier" and the other as a "prefix". The identifier is normalized by removing spaces, converting it to lowercase, and stripping non-alphanumeric characters. The key is then returned in the format:
prefix-identifier-key
.If either argument is
undefined
or cannot be determined, the hook returnsundefined
.Example Usage: