How to use the @igo2/utils.ObjectUtils.copyDeep function in @igo2/utils

To help you get started, we’ve selected a few @igo2/utils 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 infra-geo-ouverte / igo2-lib / packages / geo / src / lib / filter / shared / ogc-filter.ts View on Github external
pb = ObjectUtils.copyDeep(pushButtons);
      pb.groups.forEach(group => {
        group.title = group.title ? group.title : group.name;
        group.enabled = group.enabled ? group.enabled : false;
        group.computedButtons = ObjectUtils.copyDeep(pb.bundles.filter(b => group.ids.includes(b.id)));
      });
    } else if (!pushButtons.groups && pushButtons.bundles) {
      pb = ObjectUtils.copyDeep(pushButtons);
      pb.groups = [{ title: 'group1', name: 'group1', computedButtons: ObjectUtils.copyDeep(pb.bundles) } as PushButtonGroup];
    } else {
      pb = {
        bundles: pushButtons as OgcPushButtonBundle[],
        groups: [
          {
            title: 'group1', name: 'group1',
            computedButtons: ObjectUtils.copyDeep(pushButtons) as OgcPushButtonBundle[]
          } as PushButtonGroup]
      };
    }
    if (!pb.groups.find(pbGroup => pbGroup.enabled)) {
      pb.groups[0].enabled = true;
    }
    return pb;
  }
github infra-geo-ouverte / igo2-lib / packages / geo / src / lib / filter / shared / ogc-filter.ts View on Github external
private computeIgoPushButton(pushButtons: IgoPushButton): IgoPushButton {
    let pb: IgoPushButton;
    if (pushButtons.groups && pushButtons.bundles) {
      if (!pushButtons.bundles.every(bundle => bundle.id !== undefined)) {
        throw new Error('You must set an id for each of your pushButtons bundles');
      }
      pb = ObjectUtils.copyDeep(pushButtons);
      pb.groups.forEach(group => {
        group.title = group.title ? group.title : group.name;
        group.enabled = group.enabled ? group.enabled : false;
        group.computedButtons = ObjectUtils.copyDeep(pb.bundles.filter(b => group.ids.includes(b.id)));
      });
    } else if (!pushButtons.groups && pushButtons.bundles) {
      pb = ObjectUtils.copyDeep(pushButtons);
      pb.groups = [{ title: 'group1', name: 'group1', computedButtons: ObjectUtils.copyDeep(pb.bundles) } as PushButtonGroup];
    } else {
      pb = {
        bundles: pushButtons as OgcPushButtonBundle[],
        groups: [
          {
            title: 'group1', name: 'group1',
            computedButtons: ObjectUtils.copyDeep(pushButtons) as OgcPushButtonBundle[]
          } as PushButtonGroup]
      };
    }
    if (!pb.groups.find(pbGroup => pbGroup.enabled)) {
      pb.groups[0].enabled = true;
    }
    return pb;
  }
github infra-geo-ouverte / igo2-lib / packages / geo / src / lib / filter / shared / ogc-filter.ts View on Github external
pb.groups.forEach(group => {
        group.title = group.title ? group.title : group.name;
        group.enabled = group.enabled ? group.enabled : false;
        group.computedButtons = ObjectUtils.copyDeep(pb.bundles.filter(b => group.ids.includes(b.id)));
      });
    } else if (!pushButtons.groups && pushButtons.bundles) {
github infra-geo-ouverte / igo2-lib / packages / geo / src / lib / filter / shared / ogc-filter.ts View on Github external
private computeIgoPushButton(pushButtons: IgoPushButton): IgoPushButton {
    let pb: IgoPushButton;
    if (pushButtons.groups && pushButtons.bundles) {
      if (!pushButtons.bundles.every(bundle => bundle.id !== undefined)) {
        throw new Error('You must set an id for each of your pushButtons bundles');
      }
      pb = ObjectUtils.copyDeep(pushButtons);
      pb.groups.forEach(group => {
        group.title = group.title ? group.title : group.name;
        group.enabled = group.enabled ? group.enabled : false;
        group.computedButtons = ObjectUtils.copyDeep(pb.bundles.filter(b => group.ids.includes(b.id)));
      });
    } else if (!pushButtons.groups && pushButtons.bundles) {
      pb = ObjectUtils.copyDeep(pushButtons);
      pb.groups = [{ title: 'group1', name: 'group1', computedButtons: ObjectUtils.copyDeep(pb.bundles) } as PushButtonGroup];
    } else {
      pb = {
        bundles: pushButtons as OgcPushButtonBundle[],
        groups: [
          {
            title: 'group1', name: 'group1',
            computedButtons: ObjectUtils.copyDeep(pushButtons) as OgcPushButtonBundle[]
          } as PushButtonGroup]