* Extract duplicated function into babel-types Also reimplements in a sane way. * Add tests * cleanup