invertString
invertString(
input):string
Defined in: aberdeen.ts:235
Creates a new string that has the opposite sort order compared to the input string.
This is achieved by flipping the bits of each character code in the input string.
The resulting string is intended for use as a sort key, particularly with the
makeKey function in onEach, to achieve a descending sort order.
Warning: The output string will likely contain non-printable characters or appear as gibberish and should not be displayed to the user.
Parameters
Section titled “Parameters”string
The string whose sort order needs to be inverted.
Returns
Section titled “Returns”string
A new string that will sort in the reverse order of the input string.
Example
Section titled “Example”const $users = A.proxy([ { id: 1, name: 'Charlie', score: 95 }, { id: 2, name: 'Alice', score: 100 }, { id: 3, name: 'Bob', score: 90 },]);
A.onEach($users, ($user) => { A(`p#${$user.name}: ${$user.score}`);}, ($user) => A.invertString($user.name)); // Reverse alphabetic orderonEach for usage with sorting.