How to use the @uirouter/core.map function in @uirouter/core

To help you get started, we’ve selected a few @uirouter/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ui-router / react / src / reactViews.tsx View on Github external
export function reactViewsBuilder(state: StateObject) {
  let views = {},
    viewsDefinitionObject;
  if (!state.views) {
    viewsDefinitionObject = { $default: pick(state, ['component']) };
  } else {
    viewsDefinitionObject = map(state.views, (val: any, key) => {
      if (val.component) return val;
      return { component: val };
    });
  }

  forEach(viewsDefinitionObject, function(config, name) {
    name = name || '$default'; // Account for views: { "": { template... } }
    if (Object.keys(config).length == 0) return;

    config.$type = 'react';
    config.$context = state;
    config.$name = name;

    let normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);
    config.$uiViewName = normalized.uiViewName;
    config.$uiViewContextAnchor = normalized.uiViewContextAnchor;
github ui-router / react / src / reactViews.tsx View on Github external
export function reactViewsBuilder(state: StateObject) {
  let views = {},
    viewsDefinitionObject;
  if (!state.views) {
    viewsDefinitionObject = { $default: pick(state, ['component']) };
  } else {
    viewsDefinitionObject = map(
      state.views,
      (val: any, key) => {
        if (val.component) return val;
        return { component: val };
      },
      viewsDefinitionObject,
    );
  }

  forEach(viewsDefinitionObject, function(config, name) {
    name = name || '$default'; // Account for views: { "": { template... } }
    if (Object.keys(config).length == 0) return;

    config.$type = 'react';
    config.$context = state;
    config.$name = name;