lodash#flattenDeep JavaScript Examples

The following examples show how to use lodash#flattenDeep. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: debug-toolbar.js    From ThreatMapper with Apache License 2.0 6 votes vote down vote up
function addAllVariants(dispatch) {
  const newNodes = flattenDeep(STACK_VARIANTS.map(stack => (SHAPES.map((s) => {
    if (!stack) return [deltaAdd(label(s, stack), [], s, stack)];
    return times(3).map(() => deltaAdd(label(s, stack), [], s, stack));
  }))));

  dispatch(receiveNodesDelta({
    add: newNodes
  }));
}
Example #2
Source File: debug-toolbar.js    From ThreatMapper with Apache License 2.0 6 votes vote down vote up
function addAllMetricVariants(availableMetrics) {
  const newNodes = flattenDeep(METRIC_FILLS.map((v, i) => (
    SHAPES.map(s => [addMetrics(availableMetrics, deltaAdd(label(s) + i, [], s), v)])
  )));

  return (dispatch) => {
    dispatch(receiveNodesDelta({
      add: newNodes
    }));
  };
}
Example #3
Source File: App.js    From fluentui-starter with MIT License 6 votes vote down vote up
function App({ theme }) {
  const { semanticColors } = theme;
  React.useLayoutEffect(() => {
    document.body.style.backgroundColor = semanticColors.bodyBackground;
    document.body.style.color = semanticColors.bodyText;
  }, [semanticColors]);

  const routeList = hierarchize(routes, null, generateRoutePath);

  const routeComponents = renderRoute(routeList);
  const flatRouteComponents = flattenDeep(routeComponents);

  return (
    <Router basename="/fluentui-starter">
      <AutoSwitchLayout>
        <Suspense fallback={<ProgressIndicator label="Page loading..." />}>
          <Switch>
            {flatRouteComponents}
            <Route path="*">
              <NoMatch />
            </Route>
          </Switch>
        </Suspense>
      </AutoSwitchLayout>
    </Router>
  );
}