How to make a function with dash parameters in Bash

Question:
How do I make a function that has dash parameters in Bash?
Repl link:

greet() {
  echo "Hello, $n!"
}

greet -n "Jack"

I just did a Phind search and it doesn’t seem to be possible

Phind did say something like this could work, though

greet() {
    while [ $# -gt 0 ]; do
        if [[ \$1 == *"--"* ]]; then
            v="${1/--/}"
            declare $v="\$2"
        fi
        shift
    done
    echo "Hello, $n!"
}

greet --n "Jack"
  1. It doesn’t work
  2. I want to use a built-in bash method but this recreates it.
  3. please don’t use Phind. He just scrapes Google, and Google doesn’t really help