How to use the lodash-es.find 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 Sunbird-Ed / SunbirdEd-portal / src / app / client / projects / desktop / src / app / modules / user-profile / components / update-location / update-location.component.ts View on Github external
.subscribe(data => {
        this.districtList = _.get(data, 'result.response');
        this.selectedDistrict = _.find(this.districtList, { name: this.selectedDistrict['name'] });
      });
  }
github Sunbird-Ed / SunbirdEd-portal / src / app / client / src / app / modules / cbse-program / components / chapter-list / chapter-list.component.ts View on Github external
public getButtonStatus(data, topic: string) {
    const topicData = _.find(data, { name: topic.toLowerCase() });
    return topicData ? topicData.resourceId : 0;
  }
github Sunbird-Ed / SunbirdEd-portal / src / app / client / src / app / modules / search / components / user-edit / user-edit.component.ts View on Github external
this.profileService.getUserLocation(requestData).subscribe(res => {
      this.allBlocks = res.result.response;
      const location = _.find(this.userDetails.userLocations, (locations) => {
        return locations.type === 'block';
      });
      let locationExist: any;
      if (location) {
        locationExist = _.find(this.allBlocks, (locations) => {
          return locations.code === location.code;
        });
      }

      locationExist ? this.userDetailsForm.controls['block'].setValue(locationExist.code) :
        this.userDetailsForm.controls['block'].setValue('');
      this.blockLoader = false;
    }, err => {
      this.toasterService.error(this.resourceService.messages.emsg.m0005);
github Sunbird-Ed / SunbirdEd-portal / src / app / client / src / app / modules / workspace / components / update-batch / update-batch.component.ts View on Github external
_.forEach(this.batchDetails.mentors, (value, key) => {
      const mentor = _.find(mentorList, ['id', value]);
      if (mentor) {
        this.selectedMentors.push(mentor);
      }
    });
    this.selectedParticipants = _.uniqBy(this.selectedParticipants, 'id');
github openshift / console / frontend / public / module / k8s / cluster-operator.ts View on Github external
export const getStatusAndMessage = (operator: ClusterOperator) => {
  const conditions = _.get(operator, 'status.conditions');
  const degraded: any = _.find(conditions, { type: 'Degraded', status: 'True' });
  if (degraded) {
    return { status: OperatorStatus.Degraded, message: degraded.message };
  }

  const progressing: any = _.find(conditions, { type: 'Progressing', status: 'True' });
  if (progressing) {
    return { status: OperatorStatus.Updating, message: progressing.message };
  }

  const available: any = _.find(conditions, { type: 'Available', status: 'True' });
  if (available) {
    return { status: OperatorStatus.Available, message: available.message };
  }

  return { status: OperatorStatus.Unknown, message: '' };
};
github Sunbird-Ed / SunbirdEd-portal / src / app / client / src / app / modules / cbse-program / components / collection / collection.component.ts View on Github external
_.forEach(filterArr, (collection) => {
        if (collection.length > 1) {
          const groupedCollection = _.find(collection, (item) => {
            return item.status === 'Draft';
          });
          filteredTextbook.push(groupedCollection);
        } else {
          filteredTextbook.push(collection[0]);
        }
      });
      const collectionCards = this.utilService.getDataForCard(filteredTextbook, constantData, dynamicFields, metaData);
github virtool / virtool / client / src / js / references / components / Item.js View on Github external
export const Item = props => {
    const origin = getOrigin(props);

    let progress = 0;
    let step;

    if (props.process && props.processes.length) {
        const process = find(props.processes, ["id", props.process.id]);
        progress = process ? process.progress : 1;
        step = process ? process.step : "None";
        progress *= 100;
    } else {
        step = "None";
        progress = 100;
    }

    return (
github openshift / console / frontend / public / components / utils / simple-tab-nav.tsx View on Github external
constructor(props) {
    super(props);
    this.onClickTab = this.onClickTab.bind(this);
    const selectedTab = _.find(props.tabs, { name: props.selectedTab }) || _.head(props.tabs);
    this.state = { selectedTab };
  }
github archivist / archivist / packages / metadata-editor / ReferenceEditor.js View on Github external
_getAndStoreEntity(entityId, cb) {
    let resources = this.context.editorSession.resources
    let entity = find(resources, item => { return item.entityId === entityId })
    if(entity) {
      return cb(null, entity)
    } else {
      let resourceClient = this.context.resourceClient
      resourceClient.getEntity(entityId, (err, entity) => {
        if (err) return cb(err)
        resources.push(entity)
        return cb(null, entity)
      })
    }
  }
github archivist / archivist / packages / resources / ResourcesContext.js View on Github external
getEntry(refId) {
    let editorSession = this.context.editorSession
    let resources = editorSession.resources
    let entry = find(resources, r => {return r.entityId === refId})
    return entry
  }