generalised wrapper solution to simplify similar future problems

as requested by @jasvir at https://github.com/Constellation/estraverse/commit/80d3e6b42f4eb4a4db9b9897895729ef20b65a80#commitcomment-2404694