How to use the lodash-es.get 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 microsoft / fast-dna / packages / fast-data-utilities-react / src / index.spec.ts View on Github external
},
            ],
        };

        const mappedData: any = mapDataToComponent(childrenSchema, data, childOptions);

        expect(typeof get(mappedData, "children[0].type")).toBe("function");
        expect(get(mappedData, "children[0].type.displayName")).toBe("Children");
        expect(typeof get(mappedData, "children[0].props.children.type")).toBe(
            "function"
        );
        expect(get(mappedData, "children[0].props.children.type.displayName")).toBe(
            "Text field"
        );
        expect(typeof get(mappedData, "children[1].type")).toBe("function");
        expect(get(mappedData, "children[1].type.displayName")).toBe("Text field");
    });
    test("should map simple data to a plugin", () => {
github openshift / console / frontend / public / components / utils / build-strategy.tsx View on Github external
export const BuildStrategy: React.SFC = ({ resource, children }) => {
  const dockerfile = _.get(resource, 'spec.source.dockerfile');
  const jenkinsfile = _.get(resource, 'spec.strategy.jenkinsPipelineStrategy.jenkinsfile');
  const strategyType = getStrategyType(resource.spec.strategy.type);
  const buildFromPath = ['spec', 'strategy', strategyType, 'from'];
  const buildFrom = _.get(resource, buildFromPath);
  const outputTo = _.get(resource, 'spec.output.to');
  const commitMessage = _.get(resource, 'spec.revision.git.message');
  const commitHash = _.get(resource, 'spec.revision.git.commit');
  const commitAuthorName = _.get(resource, 'spec.revision.git.author.name');
  const pushSecret = _.get(resource, 'spec.output.pushSecret');
  const resourceLimits = _.get(resource, 'spec.resources.limits');
  const triggers = _.map(resource.spec.triggers, 'type').join(', ');

  return (
    <dl>
      {children}
      
      
      
      {commitMessage &amp;&amp; (
        </dl>
github openshift / console / frontend / public / components / operator-lifecycle-manager / subscription.tsx View on Github external
? 
              : <button type="button"> approvalModal()}&gt;{obj.spec.installPlanApproval || 'Automatic'}</button>
            }
          
        
        <div>
          <dl>
            <dt>Upgrade Status</dt>
            <dd>{subscriptionState(_.get(obj.status, 'state'))}</dd>
          </dl>
          <div></div>
          <div>
            { _.get(obj.status, 'installedCSV') &amp;&amp; installedCSV
              ? 1 installed
              : <span>0 installed</span> }
            { _.get(obj.status, 'state') === SubscriptionState.SubscriptionStateUpgradePending &amp;&amp; _.get(obj.status, 'installplan') &amp;&amp; this.props.installPlan
              ? 
                <span>{installPlanPhase(this.props.installPlan)}</span>
              
              : <span>0 installing</span> }
          </div>
        </div>
      
    ;
  }
}
github Sunbird-Ed / SunbirdEd-portal / src / app / client / projects / desktop / src / app / modules / offline / components / library-filters / library-filters.component.ts View on Github external
.subscribe((res) => {
              if (res && _.get(res, 'result.framework.categories')) {
                this.frameworkCategories = _.get(res, 'result.framework.categories');
                if (_.get(this.selectedFilters, 'board[0]')) {
                  this.setFilters(false);
                } else {
                  this.setFilters(true);
                }
              }
            });
        }
github openshift / console / frontend / public / components / masthead-toolbar.jsx View on Github external
_updateUser() {
    const { flags, user } = this.props;
    if (!flags[FLAGS.OPENSHIFT]) {
      this.setState({ username: authSvc.name() });
    }
    this.setState({
      username: _.get(user, 'fullName') || _.get(user, 'metadata.name', ''),
      isKubeAdmin: _.get(user, 'metadata.name') === 'kube:admin',
    });
  }
github openshift / console / frontend / public / components / build.tsx View on Github external
const BuildGraphs = requirePrometheus(({ build }) =&gt; {
  const podName = _.get(build, ['metadata', 'annotations', 'openshift.io/build.pod-name']);
  if (!podName) {
    return null;
  }

  const namespace = build.metadata.namespace;

  return (
    &lt;&gt;
      <div>
        <div>
          </div></div>
github openshift / console / frontend / public / components / deploy-image.tsx View on Github external
const runsAsRoot = image => {
  const user = _.get(image, 'dockerImageMetadata.Config.User');
  return !user ||
          user === '0' ||
          user === 'root';
};
github ddhp / react-isomorphic-boilerplate / src / containers / Home / index.js View on Github external
export function mapStateToProps(state) {
  const postEntity = _get(state, 'entities.post');
  const postIds = _get(state, 'pages.home.posts');
  let posts = postIds.map(id => postEntity[id] || {});
  posts = posts.slice(0, 20);
  debug(posts);

  return {
    posts,
  };
}
github Sunbird-Ed / SunbirdEd-portal / src / app / client / projects / desktop / src / app / modules / user-profile / components / update-content-preference / update-content-preference.component.ts View on Github external
.subscribe((data) => {
          if (data && _.get(data, 'result.framework.categories')) {
            this.frameworkCategories = _.get(data, 'result.framework.categories');
            const board = _.find(this.frameworkCategories, (element) => {
              return element.code === 'board';
            });
            this.mediumOption = this.userService.getAssociationData(board.terms, 'medium', this.frameworkCategories);
            if (this.contentPreferenceForm.value.board.name === this.frameworkDetails['board']) {
          this.contentPreferenceForm.controls['medium'].setValue(this.filterContent(this.mediumOption, this.frameworkDetails['medium']));
            }

          }
        }, err => {
        });