KeyMapping typedef
Often it is desirable to define equivalences between Key strings, for example for case insensitivity.
This is achieved via the surjection:
- m : S↠ K ⊆ S
such that:
- S is set of all strings
- K is set of Keys
m(m(x)) = m(x), i.e. m must be idempotent, repeated applications do not change the result.
For example:
- m(x) = lowercase(x).
KeyMapping is optionally specified during construction and applied to keys during all operations.
If no KeyMapping is supplied then the default identity function is used.
- m(x) = x.
Predefined mappings include:
If str
is null then the name of the keymapping is returned.
Implementation
typedef KeyMapping = String Function(String? str);