more tiny improvements

use `charAt` insteadof `startsWith`/`endsWith` when checking for single characters, reduce number of calls to `isNullish`