IvanMathy / Boop

A scriptable scratchpad for developers. In slow yet steady progress.
https://boop.okat.best
MIT License
3.77k stars 346 forks source link

RangeError. Internal Error. Icu error in custom script #362

Closed azzamsa closed 1 year ago

azzamsa commented 1 year ago

Hi.

I want to have my words sorted. I write this script in node, and it runs fine.

let text =
  "emacs nnn jq ShellCheck tidy neofetch stow workrave pandoc flameshot copyq";

let sorted = text
  .split(" ")
  .sort((a, b) => a.localeCompare(b))
  .join(" ");
console.log(sorted);
⬢ ❯ node sort.js
copyq emacs flameshot jq neofetch nnn pandoc ShellCheck stow tidy workrave

But, when putting it in boop, I got the error below. RangeError. Internal Error. Icu error

/**
     {
         "api":1,
         "name":"Sort words",
         "description":"Sort words alphabetically",
         "author":"Azzam S.A (https://github.com/azzams)",
         "icon":"sort-characters",
         "tags":"sort,alphabet"
     }
 **/

function main(input) {
  input.text = input.text
    .replace(/\n$/, "")
    .split(" ")
    .sort((a, b) => a.localeCompare(b))
    .join(" ");
}

image

azzamsa commented 1 year ago

The issue is more suitable here: https://github.com/zoeyfyi/Boop-GTK/issues/397