Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 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) => {
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;
};
/**
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];
}
var sortedLastChildArr = _.sortBy(lastChildArr, function (child) {
var stmtView = _.isNil(child) ? undefined : self.getDiagramRenderingContext().getViewOfModel(child);
return _.isNil(stmtView) ? -1 : stmtView.getBoundingBox().getBottom();
});
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>
async panel () {
if (_.isNil(global.panel)) return setTimeout(() => this.panel(), 10)
global.panel.addMenu({ category: 'manage', name: 'event-listeners', id: 'events' })
this.sockets()
}
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});
}
}
product =>
Array.isArray(product.categories) &&
!_.isNil(_.find(product.categories, { id: categoryId })),
);
publish(event, data) {
if (_.isNil(this._pubsub)) {
throw new Error("No PubSub provided");
}
this._pubsub.publish(event, data);
return this;
}
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 {