How to use the util.isNullOrUndefined function in util

To help you get started, we’ve selected a few util 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 jamesshore / lets_code_javascript / node_modules / browserify / node_modules / insert-module-globals / buffer.js View on Github external
function objEquiv(a, b) {
  if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b))
    return false;
  // an identical 'prototype' property.
  if (a.prototype !== b.prototype) return false;
  //~~~I've managed to break Object.keys through screwy arguments passing.
  //   Converting to array solves the problem.
  if (isArguments(a)) {
    if (!isArguments(b)) {
      return false;
    }
    a = pSlice.call(a);
    b = pSlice.call(b);
    return _deepEqual(a, b);
  }
  try {
    var ka = shims.keys(a),
        kb = shims.keys(b),
github zowe / imperative / packages / cmd / src / help / DefaultHelpGenerator.ts View on Github external
if (this.mCommandDefinition.experimental) {
                helpText += this.grey(DefaultHelpGenerator.HELP_INDENT + "(experimental command)\n\n");
            } else {
                helpText += "\n\n";
            }
        }

        // Only include global options by request and we're not producing markdown
        includeGlobalOptions = includeGlobalOptions && !this.mProduceMarkdown;

        // Print standard areas like description and usage
        helpText += this.buildDescriptionSection();
        helpText += this.buildUsageSection();

        // Add positional arguments to the help text
        if (!isNullOrUndefined(this.mCommandDefinition.positionals) &&
            this.mCommandDefinition.positionals.length > 0) {
            helpText += this.buildPositionalArgumentsSection();
        }

        // Add options to the help text
        helpText += this.buildCommandOptionsSection();
        if (includeGlobalOptions) {
            helpText += this.buildGlobalOptionsSection();
        }

        // Build experimental description section and examples
        helpText += this.getExperimentalCommandSection();
        helpText += this.buildExamplesSection();
        return helpText;
    }
github eclipse / winery / org.eclipse.winery.frontends / app / tosca-management / src / app / instance / sharedComponents / propertiesDefinition / propertiesDefinition.component.ts View on Github external
onCustomKeyValuePairSelected(): void {
        this.resourceApiData.selectedValue = PropertiesDefinitionEnum.Custom;

        if (isNullOrUndefined(this.resourceApiData.propertiesDefinition)) {
            this.resourceApiData.propertiesDefinition = new PropertiesDefinition();
        }
        this.resourceApiData.propertiesDefinition.element = null;
        this.resourceApiData.propertiesDefinition.type = null;

        if (isNullOrUndefined(this.resourceApiData.propertiesDefinition)) {
            this.resourceApiData.propertiesDefinition = new PropertiesDefinition();
        }
        this.resourceApiData.propertiesDefinition.element = null;
        this.resourceApiData.propertiesDefinition.type = null;

        if (isNullOrUndefined(this.resourceApiData.winerysPropertiesDefinition)) {
            this.resourceApiData.winerysPropertiesDefinition = new WinerysPropertiesDefinition();
        }
        // The key/value pair list may be null
        if (isNullOrUndefined(this.resourceApiData.winerysPropertiesDefinition.propertyDefinitionKVList)) {
            this.resourceApiData.winerysPropertiesDefinition.propertyDefinitionKVList = [];
        }

        if (isNullOrUndefined(this.resourceApiData.winerysPropertiesDefinition.namespace)) {
            this.resourceApiData.winerysPropertiesDefinition.namespace = this.sharedData.toscaComponent.namespace + '/propertiesdefinition/winery';
        }
        if (isNullOrUndefined(this.resourceApiData.winerysPropertiesDefinition.elementName)) {
            this.resourceApiData.winerysPropertiesDefinition.elementName = 'properties';
        }

        this.activeElement = new SelectData();
        this.activeElement.text = this.resourceApiData.winerysPropertiesDefinition.namespace;
github martinroob / ngx-i18nsupport / src / xliffmerge / xliff-file.ts View on Github external
private initializeTransUnits() {
        if (isNullOrUndefined(this.transUnits)) {
            this.transUnits = [];
            let transUnitsInFile = this.xliffContent('trans-unit');
            transUnitsInFile.each((index, transunit: CheerioElement) => {
                let id = cheerio(transunit).attr('id');
                if (!id) {
                    this._warnings.push(format('oops, trans-unit without "id" found in master, please check file %s', this.filename));
                    this._numberOfTransUnitsWithMissingId++;
                }
                this.transUnits.push(new TransUnit(transunit, id));
            });
        }
    }
github zowe / imperative / packages / cmd / src / syntax / SyntaxValidator.ts View on Github external
private getMustacheSummaryForOption(optionDefinition: ICommandOptionDefinition | ICommandPositionalDefinition,
                                        isPositional: boolean = false): any {
        let aliasString;

        if (!isPositional) {
            const def = optionDefinition as ICommandOptionDefinition;
            aliasString = (!isNullOrUndefined(def.aliases) && def.aliases.length > 0) ?
                "(" + def.aliases.map((alias: string) => {
                    return this.getDashFormOfOption(alias);
                }).join(",") + ")" : "";
        } else {
            aliasString = "";
        }
        let longName: string;
        if (isPositional) {
            longName = CliUtils
                .getPositionalSyntaxString(optionDefinition.required, optionDefinition.name);
        } else {
            longName = CliUtils.getDashFormOfOption(optionDefinition.name);
        }
        return {
            long: longName,
            aliases: aliasString,
github eclipse / winery / org.eclipse.winery.frontends / app / tosca-management / src / app / instance / serviceTemplates / boundaryDefinitions / propertyMappings / propertyMappings.component.ts View on Github external
getListOfTemplates(templateType: string): Array {
        if (!isNullOrUndefined(this.topologyTemplate[templateType])) {
            return this.topologyTemplate[templateType].map((template: WineryTemplate) => {
                const newItem: SelectItem = new SelectItem('');
                newItem.id = template.id;
                newItem.text = template.id;
                return newItem;
            });
        } else {
            this.notify.warning('No ' + Utils.getToscaTypeNameFromToscaType(this.toscaType) + ' available.\nTo select a ' +
                Utils.getToscaTypeNameFromToscaType(this.toscaType) +
                ' add at least one to the topology');
        }
    }
github eclipse / winery / org.eclipse.winery.repository.ui / src / app / section / xaasPackager / xaasPackager.component.ts View on Github external
onAddClick() {
        const formData: FormData = new FormData();
        if (!isNullOrUndefined(this.file)) {
            formData.append('file', this.file, this.file.name);
        }
        if (!isNull(this.selectedArtifactType)) {
            formData.append('artifactType', this.selectedArtifactType);
        }
        if (!isNullOrUndefined(this.selectedNodeTypes)) {
            for (const nodetype of this.selectedNodeTypes) {
                formData.append('nodeTypes', nodetype);
            }
        }

        if (!isNullOrUndefined(this.tagItems)) {
            for (const tag of this.tagItems) {
                formData.append('tags', tag);
            }
        } else {
            formData.append('tags', '');
        }

        if (!isNullOrUndefined(this.selectedInfracstuctureNodeType)) {
            formData.append('infrastructureNodeType', this.selectedInfracstuctureNodeType);
        }

        this.service.createTemplateFromArtifact(formData).subscribe(
            data => this.notify.success('Service Template successfully created!'),
            error => this.handleError(error)
        );
github eclipse / winery / org.eclipse.winery.repository.ui / src / app / section / entityContainer / entityContainer.component.ts View on Github external
private calculateTreeHeight(children = 0) {
        let offset = 139;
        let childrenCount = this.data.versionInstances.length - 1;
        if (children > 0) {
            childrenCount += children - 1;
            offset = offset * 2 + 15;
        }
        if (!isNullOrUndefined(this.differences)) {
            offset += 205;
        }
        this.treeHeight = (childrenCount * 126) + offset;
    }
github zowe / imperative / packages / cmd / src / CommandPreparer.ts View on Github external
private static performBasicPositionalValidation(positionals: ICommandPositionalDefinition[], currentDefinitions: ICommandDefinition[]) {
        for (const pos of positionals) {
            /**
             * All positionals must have a name
             */
            if (isNullOrUndefined(pos.name) || pos.name.trim().length === 0) {
                throw new ImperativeError({
                    msg: `A positional definition contains an undefined or empty name.`,
                    additionalDetails: "POSITIONAL_DEFINITION:\n" + JSON.stringify(pos) + "\nCURRENT_TREE:\n" + JSON.stringify(currentDefinitions)
                });
            }

            /**
             * All positionals must have a type
             */
            if (isNullOrUndefined(pos.type) || pos.type.trim().length === 0) {
                throw new ImperativeError({
                    msg: `A positional definition (${pos.name}) contains an undefined or empty type.`,
                    additionalDetails: "POSITIONAL_DEFINITION:\n" + JSON.stringify(pos) + "\nCURRENT_TREE:\n" + JSON.stringify(currentDefinitions)
                });
            }

            /**
             * All positionals must have a non-blank description
             */
            if (isNullOrUndefined(pos.description) || pos.description.trim().length === 0) {
                throw new ImperativeError({
                    msg: `A positional definition (${pos.name} of type ${pos.type}) contains an ` +
                    `undefined or empty description.`,
                    additionalDetails: "POSITIONAL_DEFINITION:\n" + JSON.stringify(pos) + "\nCURRENT_TREE:\n" + JSON.stringify(currentDefinitions)
                });
            }