@lipagas/ember-core
Version:
Provides all the core services, decorators and utilities for building a Fleetbase extension for the Console.
19 lines (13 loc) • 441 B
JavaScript
import humanize from './humanize';
export default function getResourceNameFromTransition(transition, options = {}) {
const { to } = transition;
if (typeof to.name === 'string') {
let routePathSegments = to.name.split('.');
let resourceName = routePathSegments[3];
if (options.humanize === true) {
return humanize(resourceName);
}
return resourceName;
}
return null;
}