Aberdeen - v1.0.3
    Preparing search index...

    Function invertString

    • 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

      • input: string

        The string whose sort order needs to be inverted.

      Returns string

      A new string that will sort in the reverse order of the input string.

      const users = proxy([
      { id: 1, name: 'Charlie', score: 95 },
      { id: 2, name: 'Alice', score: 100 },
      { id: 3, name: 'Bob', score: 90 },
      ]);

      onEach(users, (user) => {
      $(`p:${user.name}: ${user.score}`);
      }, (user) => invertString(user.name)); // Reverse alphabetic order

      onEach for usage with sorting.