How to use the lodash.isNil function in lodash

To help you get started, we’ve selected a few lodash 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 mspnp / template-building-blocks / spikes / nodejs-spike / core / virtualMachineSettings.js View on Github external
// computerNamePrefix
    // if computerNamePrefix is not specified, use namePrefix
    if (v.utilities.isNullOrWhitespace(updatedSettings.computerNamePrefix) && !v.utilities.isNullOrWhitespace(updatedSettings.namePrefix)) {
        updatedSettings.computerNamePrefix = updatedSettings.namePrefix;
    }

    // loadBalancerSettings
    if (!_.isNil(updatedSettings.loadBalancerSettings)) {
        // if loadBalancerSettings is specified, add vmCount and virtualNetwork info from vm settings to the LB settings
        updatedSettings.loadBalancerSettings.vmCount = updatedSettings.vmCount;
        updatedSettings.loadBalancerSettings.virtualNetwork = updatedSettings.virtualNetwork;
    }

    // applicationGatewaySettings
    if (!_.isNil(updatedSettings.applicationGatewaySettings)) {
        // if applicationGatewaySettings is specified, add vmCount and virtualNetwork info from vm settings to the gateway settings
        updatedSettings.applicationGatewaySettings.vmCount = updatedSettings.vmCount;
        updatedSettings.applicationGatewaySettings.virtualNetwork = updatedSettings.virtualNetwork;
    }

    if (!_.isNil(updatedSettings.scaleSetSettings)) {
        let autoScale = updatedSettings.scaleSetSettings.autoScaleSettings;

        if (v.utilities.isNullOrWhitespace(autoScale.name)) {
            autoScale.name = `${updatedSettings.scaleSetSettings.name}-auto`;
        }
        if (v.utilities.isNullOrWhitespace(autoScale.targetResourceUri)) {
            autoScale.targetResourceUri = resources.resourceId(settings.subscriptionId, settings.resourceGroupName, 'Microsoft.Compute/virtualMachineScaleSets', updatedSettings.scaleSetSettings.name);
        }

        autoScale.profiles.forEach((p) => {
github recharts / recharts / src / util / ChartUtils.ts View on Github external
export function getValueByDataKey(obj: T, dataKey: DataKey, defaultValue?: any) {
  if (_.isNil(obj) || _.isNil(dataKey)) { return defaultValue; }

  if (isNumOrStr(dataKey as string)) { return _.get(obj, dataKey as string, defaultValue); }

  if (_.isFunction(dataKey)) { return dataKey(obj); }

  return defaultValue;
};
/**
github ballerina-attic / composer / modules / web / js / ballerina / diagram / views / sizing-util.js View on Github external
getWorkerReplyStatementTo(parentNode, workerName) {
        let childNodes;
        if (!_.isNil(parentNode)) {
            childNodes = _.filter(parentNode.getChildren(), (child) => {
                if (ASTFactory.isWorkerReplyStatement(child)) {
                    return child.getWorkerName() === workerName;
                }
                return false;
            });
        }

        if (_.isNil(childNodes)) {
            return undefined;
        }
        return childNodes[0];
    }
github ballerina-attic / composer / modules / web / js / ballerina / views / function-definition-view.js View on Github external
var sortedLastChildArr = _.sortBy(lastChildArr, function (child) {
            var stmtView = _.isNil(child) ? undefined : self.getDiagramRenderingContext().getViewOfModel(child);
            return _.isNil(stmtView) ? -1 : stmtView.getBoundingBox().getBottom();
        });
github openshift / console / frontend / packages / operator-lifecycle-manager / src / components / descriptors / spec / index.tsx View on Github external
const BooleanSwitch: React.FC = (props) => {
  const convertedValue = !_.isNil(props.value) ? props.value : false;
  const [value, setValue] = React.useState(convertedValue);
  const [confirmed, setConfirmed] = React.useState(false);

  const patchFor = (val: boolean) => [
    { op: 'add', path: `/spec/${props.descriptor.path.replace('.', '/')}`, value: val },
  ];
  const update = () => {
    setConfirmed(true);
    return k8sPatch(props.model, props.obj, patchFor(value));
  };

  return (
    <div>
      </div>
github sogehige / sogeBot / src / bot / events.js View on Github external
async panel () {
    if (_.isNil(global.panel)) return setTimeout(() => this.panel(), 10)
    global.panel.addMenu({ category: 'manage', name: 'event-listeners', id: 'events' })
    this.sockets()
  }
github ballerina-attic / composer / modules / web / js / ballerina / ast / statements / while-statement.js View on Github external
setConditionFromString(conditionString) {
        if (!_.isNil(conditionString) || !_.isEmpty(conditionString)) {
            const fragment = FragmentUtils.createExpressionFragment(conditionString);
            const parsedJson = FragmentUtils.parseFragment(fragment);
            const condition = ASTFactory.createFromJson(parsedJson);
            condition.initFromJson(parsedJson);
            this.setCondition(condition);
            condition.setParent(this, {doSilently: true});
        }
    }
github rock-solid / pwa-theme-woocommerce / src / views / Products / index.js View on Github external
product =>
        Array.isArray(product.categories) &&
        !_.isNil(_.find(product.categories, { id: categoryId })),
    );
github anhldbk / graphqly / lib / base / resolvable.js View on Github external
publish(event, data) {
    if (_.isNil(this._pubsub)) {
      throw new Error("No PubSub provided");
    }
    this._pubsub.publish(event, data);
    return this;
  }
github microsoft / pai / src / rest-server / src / models / v1 / job / yarn.js View on Github external
generateExitSpec(code) {
    if (!_.isNil(code)) {
      if (!_.isNil(exitSpecMap[code])) {
        return exitSpecMap[code];
      } else {
        if (code > 0) {
          return {
            ...exitSpecMap[positiveFallbackExitCode],
            code,
          };
        } else {
          return {
            ...exitSpecMap[negativeFallbackExitCode],
            code,
          };
        }
      }
    } else {