How to use the lodash.isUndefined 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 apigee-127 / bagpipes / lib / helpers.js View on Github external
function getParameterValue(parameter, context) {

  var path = parameter.path || parameter;

  var value = (path[0] === '.') ? JSPath.apply(path, context) : path;

  //console.log('****', path, context, value);

  // Use the default value when necessary
  if (_.isUndefined(value)) { value = parameter.default; }

  return value;
}
github ballerina-attic / composer / modules / web / src / plugins / ballerina / diagram / views / default / components / transformer / transformer-node-manager.js View on Github external
_.forEach(structDefinition.getFields(), (field) => {
            let property = {};
            const fieldName = `${name}.${field.getName()}`;
            const currentPathFromRoot = [...pathFromRoot];
            currentPathFromRoot.push(field.getName());

            // TODO: handle recursive structs in a better manner.
            // Currently we will consider it as a primitive field.
            if (field.getType() === typeName) {
                property.name = fieldName;
                property.type = field.getType();
                property.packageName = field.getPackageName();
                property.structName = name;
            } else {
                const innerStruct = this.getStructDefinition(field.getPackageName(), field.getType());
                if (!_.isUndefined(innerStruct) && typeName !== property.type) {
                    property = this.getStructType(fieldName, field.getType(), innerStruct, root, currentPathFromRoot);
                } else {
                    property.name = fieldName;
                    property.type = field.getType();
                    property.packageName = field.getPackageName();
                    property.structName = name;
                }
            }

            property.pathFromRoot = currentPathFromRoot;
            property.isField = true;
            property.root = root;
            property.displayName = field.getName();

            struct.properties.push(property);
        });
github majodev / google-webfonts-helper / server / logic / urlFetcher.js View on Github external
variantItem[type] = url;

        // if not defined, also save procedded font-family, fontstyle, font-weight, unicode-range
        if (_.isUndefined(variantItem.fontFamily) && _.isUndefined(resources[0]["font-family"]) === false) {
          variantItem.fontFamily = resources[0]["font-family"];
        }

        if (_.isUndefined(variantItem.fontStyle) && _.isUndefined(resources[0]["font-style"]) === false) {
          variantItem.fontStyle = resources[0]["font-style"];
        }

        if (_.isUndefined(variantItem.fontWeight) && _.isUndefined(resources[0]["font-weight"]) === false) {
          variantItem.fontWeight = resources[0]["font-weight"];
        }

        if (_.isUndefined(variantItem.local) && _.isUndefined(resources[0].localName) === false) {
          variantItem.local = resources[0].localName;
        }

        // successfully added type of variant, callback...
        requestCB(null);

      });
github jhipster / generator-jhipster / entity / index.js View on Github external
if (field.fieldType == 'DateTime') {
                    field.fieldType = 'ZonedDateTime';
                }
                var nonEnumType = _.contains(['String', 'Integer', 'Long', 'Float', 'Double', 'BigDecimal',
                'LocalDate', 'ZonedDateTime', 'Boolean', 'byte[]'], field.fieldType);
                if ((databaseType == 'sql' || databaseType == 'mongodb') && !nonEnumType) {
                    field.fieldIsEnum = true;
                } else {
                    field.fieldIsEnum = false;
                }

                if (_.isUndefined(field.fieldNameCapitalized)) {
                    field.fieldNameCapitalized = _s.capitalize(field.fieldName);
                }

                if (_.isUndefined(field.fieldNameUnderscored)) {
                    field.fieldNameUnderscored = _s.underscored(field.fieldName);
                }

                if (_.isUndefined(field.fieldInJavaBeanMethod)) {
                    // Handle the specific case when the second letter is capitalized
                    // See http://stackoverflow.com/questions/2948083/naming-convention-for-getters-setters-in-java
                    if (field.fieldName.length > 1) {
                        var firstLetter = field.fieldName.charAt(0);
                        var secondLetter = field.fieldName.charAt(1);
                        if (firstLetter == firstLetter.toLowerCase() && secondLetter == secondLetter.toUpperCase()) {
                            field.fieldInJavaBeanMethod = firstLetter.toLowerCase() + field.fieldName.slice(1);
                        } else {
                            field.fieldInJavaBeanMethod = _s.capitalize(field.fieldName);
                        }
                    } else {
                        field.fieldInJavaBeanMethod = _s.capitalize(field.fieldName);
github FreeFeed / freefeed-server / test / functional / functional_test_helper.js View on Github external
.then((url) => {
        const sendParams = {};

        if (!_.isUndefined(authToken)) {
          sendParams.authToken = authToken
        }

        if (!_.isUndefined(offset)) {
          sendParams.offset = offset
        }

        if (!_.isUndefined(limit)) {
          sendParams.limit = limit
        }

        request
          .get(url)
          .query(sendParams)
          .end((err, res) => {
            done(err, res)
github ExpediaInceCommercePlatform / cyclotron / cyclotron-svc / routes / api.dashboards.js View on Github external
}).exec(function (err, dashboard) {
        if (err) {
            res.status(500).send(err);
        } else if (_.isUndefined(dashboard) || _.isNull(dashboard)) {
            res.status(404).send('Dashboard not found.');
        } else {
            res.status(200).send(dashboard.likes);
        }
    });
};
github kitze / gtb / src / index.js View on Github external
function initialize() {
  addCliCommands();

  //if gtb-config doesn't exist, create it then read it and parse the cli arguments
  if (_.isUndefined(gtbConfig)) {
    con.log(`Creating gtb-config for the first time...`);
    writeFile(gtbConfigPath, {
      projects: []
    }, jsonFileSettings, () => {
      readGtbConfig();
      parseArguments();
    });
  }
  //if gtb config exists, just parse the arguments
  else {
    parseArguments();
  }
}
github podio / podio-js / lib / auth.js View on Github external
_onAccessTokenAcquired: function(responseData, callback) {

    this.authObject = new OAuth(
      responseData.access_token,
      responseData.refresh_token,
      responseData.expires_in,
      responseData.ref,
      responseData.transfer_token,
      responseData.scope
    );

    if (!_.isUndefined(this.sessionStore)) {
      this.sessionStore.set(this.authObject, this.authType, callback);
    } else if (_.isFunction(callback)) {
      callback(null, responseData);
    }
  },
github ourai / rocketz / packages / rocketz-core / lib / rocketz.js View on Github external
list( cdn, forceMap ) {
    let s = this.__settings.cdn;
    let files = {};

    if ( _.isBoolean(cdn) ) {
      forceMap = cdn;
      cdn = undefined;
    }

    let cdns = _.isUndefined(cdn) ? Object.keys(s) : toArr(cdn);

    cdns.forEach(function( c ) {
      if ( _.isString(c) && s.hasOwnProperty(c) ) {
        files[c] = [].concat(s[c].settings.__files);
      }
    });

    return (Object.keys(files).length > 1 || forceMap === true) ? files : files[cdns.shift()];
  }
github AXErunners / axecore-lib / lib / transaction / transaction.js View on Github external
_.each(this.inputs, function(input) {
      if (_.isUndefined(input.output)) {
        throw new errors.Transaction.Input.MissingPreviousOutput();
      }
      self._inputAmount += input.output.satoshis;
    });
  }