open-consul/ui/packages/consul-ui/app/helpers/flatten-property.js
John Cowen d47ccb859f
ui: Improves UI engineering docs (#9875)
Also fixes some typos in with-overlay
2021-03-17 15:58:17 +00:00

9 lines
278 B
JavaScript

import { helper } from '@ember/component/helper';
export default helper(function flattenProperty([obj, prop], hash) {
const pages = hash.pages || [];
pages.push(...obj.pages);
obj.children.forEach(child => flattenProperty([child], { pages: pages }));
return pages;
});