How to use the lodash-es/map function in lodash-es

To help you get started, we’ve selected a few lodash-es 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 NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / cicero / src / cicero-command-factory.service.ts View on Github external
constructor(private readonly urlManager: UrlManagerService,
        private readonly location: Location,
        private readonly context: ContextService,
        private readonly mask: MaskService,
        private readonly error: ErrorService,
        private readonly configService: ConfigService,
        private readonly ciceroContext: CiceroContextService,
        private readonly ciceroRenderer: CiceroRendererService) { }

    private commandsInitialised = false;

    private commandTypes = [Action, Back, Cancel, Clipboard, Edit, Enter, Forward, Gemini, Goto, Help, Menu, OK, Page, Reload, Root, Save, Selection, Show, Where];

    private allCommands: Command[] = map(this.commandTypes, T => new T(this.urlManager, this.location, this, this.context, this.mask, this.error, this.configService, this.ciceroContext, this.ciceroRenderer));

    private commands: Dictionary = fromPairs(map(this.allCommands, c => [c.shortCommand, c]));

    private mapInputToCommands(input: string) {
        if (!input) {
            // Special case for hitting Enter with no input
            return [this.getCommand('wh')];
        }
        const commands = input.split(';');
        return map(commands, c => this.getSingleCommand(c, commands.length > 1));
    }

    getCommands(input: string): ParseResult {
        try {
            return ParseResult.create(this.mapInputToCommands(input));
        } catch (e) {
            return ParseResult.createError(e.message);
        }
github hamzahamidi / Angular6-json-schema-form / projects / angular6-json-schema-form / src / lib / framework-library / bootstrap-3-framework / bootstrap-3-framework.component.ts View on Github external
this.widgetOptions.fieldHtmlClass, this.options.style || 'btn-default');
          this.options.icon = 'glyphicon glyphicon-plus';
        break;
        // Default - including regular inputs
        default:
          this.widgetOptions.fieldHtmlClass = addClasses(
            this.widgetOptions.fieldHtmlClass, 'form-control');
      }

      if (this.formControl) {
        this.updateHelpBlock(this.formControl.status);
        this.formControl.statusChanges.subscribe(status => this.updateHelpBlock(status));

        if (this.options.debug) {
          const vars: any[] = [];
          this.debugOutput = map(vars, thisVar => JSON.stringify(thisVar, null, 2)).join('\n');
        }
      }
      this.frameworkInitialized = true;
    }

  }
github ecsnavarretemit / sarai-interactive-maps / src / app / map / pages / crop-production-area-maps / crop-production-area-maps / crop-production-area-maps.component.ts View on Github external
processLayers() {
    const layers = this._tileLayerService.getCropProductionAreaLayers(this.crop);

    // assemble the layers payload for saving to the application store.
    const processedLayers = map(layers, (layer: L.WMSOptions) => {
      const payload: Layer = {
        id: layer.layers,
        type: 'crop-production-area',
        url: this._wmsTileUrl,
        layerOptions: layer
      };

      return payload;
    });

    // remove all layers present on the map
    this.removeLayers();

    // add the new layer to the store
    this._store.dispatch({
      type: 'ADD_LAYERS',
github hamzahamidi / Angular6-json-schema-form / projects / angular6-json-schema-form / src / lib / framework-library / bootstrap-4-framework / bootstrap-4-framework.component.ts View on Github external
this.widgetOptions.fieldHtmlClass, this.options.style || 'btn-default');
          this.options.icon = 'glyphicon glyphicon-plus';
        break;
        // Default - including regular inputs
        default:
          this.widgetOptions.fieldHtmlClass = addClasses(
            this.widgetOptions.fieldHtmlClass, 'form-control');
      }

      if (this.formControl) {
        this.updateHelpBlock(this.formControl.status);
        this.formControl.statusChanges.subscribe(status => this.updateHelpBlock(status));

        if (this.options.debug) {
          const vars: any[] = [];
          this.debugOutput = map(vars, thisVar => JSON.stringify(thisVar, null, 2)).join('\n');
        }
      }
      this.frameworkInitialized = true;
    }

  }
github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / view-models / src / helpers-view-models.ts View on Github external
export function createSubmenuItems(avms: ActionViewModel[], menuSlot: { name: string, action: ActionViewModel }, level: number): MenuItemViewModel {
    // if not root menu aggregate all actions with same name
    let menuActions: ActionViewModel[];
    let menuItems: MenuItemViewModel[] | null;

    if (menuSlot.name) {
        const actions = filter(avms, a => getMenuNameForLevel(a.menuPath, level) === menuSlot.name && !getMenuNameForLevel(a.menuPath, level + 1));
        menuActions = actions;

        // then collate submenus
        const submenuActions = filter(avms, a => getMenuNameForLevel(a.menuPath, level) === menuSlot.name && !!getMenuNameForLevel(a.menuPath, level + 1));
        let menuSubSlots = map(submenuActions, a => ({ name: getMenuNameForLevel(a.menuPath, level + 1), action: a }));
        menuSubSlots = removeDuplicateMenuNames(menuSubSlots);

        menuItems = map(menuSubSlots, slot => createSubmenuItems(submenuActions, slot, level + 1));
    } else {
        menuActions = [menuSlot.action];
        menuItems = null;
    }

    return new MenuItemViewModel(menuSlot.name, menuActions, menuItems);
}
github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / src / app / view-models / recent-items-view-model.ts View on Github external
private refreshItems() {       
        const items = map(this.recentlyViewed, (o, i) => ({ obj: o, link: o.updateSelfLinkWithTitle(), index: i }));
        this.recentItems = map(items, i => this.viewModelFactory.recentItemViewModel(i.obj, i.link!, this.onPaneId, false, i.index));
    }
github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / gemini / src / action-list / action-list.component.ts View on Github external
focus(actions: QueryList) {
        if (actions && actions.length > 0) {
            const actionChildrenNames = map(actions.toArray(), a => a.action.value);
            const newActions = difference(actionChildrenNames, this.previousActionChildrenNames);
            let index = 0;

            if (newActions && newActions.length > 0) {
                const firstAction = first(newActions);
                index = findIndex(actions.toArray(), a => a.action.value === firstAction);
                index = index < 0 ? 0 : index;
            }
            this.previousActionChildrenNames = actionChildrenNames;
            this.focusFromIndex(actions, index);
        }
    }
github youzan / zent / packages / zent / src / slider / Points.tsx View on Github external
render() {
    const { disabled, prefix } = this.props;
    const conf = this.getConfig();

    return (
      <div>
        {map(conf, (value, index) =&gt; this.getPoint(value, index))}
        {!disabled &amp;&amp; (
          
        )}
        {!disabled &amp;&amp; (
          
        )}
      </div>
    );
  }
}
github NakedObjectsGroup / NakedObjectsFramework / Spa2 / nakedobjectsspa / view-models / src / recent-items-view-model.ts View on Github external
private refreshItems() {
        const items = map(this.recentlyViewed, (o, i) => ({ obj: o, link: o.updateSelfLinkWithTitle(), index: i }));
        this.recentItems = map(items, i => this.viewModelFactory.recentItemViewModel(i.obj, i.link!, this.onPaneId, false, i.index));
    }
github openstreetmap / iD / modules / core / history.js View on Github external
imageryUsed: function(sources) {
            if (sources) {
                imageryUsed = sources;
                return history;
            } else {
                var arr = _map(stack.slice(1, index + 1), 'imageryUsed');
                return _without(_uniq(_flatten(arr)), 'Custom');
            }
        },