How to use the underscore.isUndefined function in underscore

To help you get started, we’ve selected a few underscore 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 encryptic-team / encryptic / src / scripts / components / notes / form / Controller.js View on Github external
preRedirect() {
        // Delete the new note model
        if (_.isUndefined(this.options.id) || _.isNull(this.options.id)) {
            this.model.set({title: 'Untitled'});
            return Radio.request('components/notes', 'remove', {
                model : this.model,
                force : true,
            });
        }

        // Restore the original state of the note.
        return this.notesChannel.request('saveModel', {
            model : this.model,
            data  : this.dataBeforeChange,
        });
    }
github silentrob / harp-editor / lib / metaData.js View on Github external
type = "text";
              }

              // Special consideration for key name
              if (prop == 'date') {
                type = "date";
              }
              
              fields.push({name: prop, type: type});
            }
          }   
        }
      }
    }

    if (metaData && metaData.editor && !_.isUndefined(metaData.editor.content)) {
      fields.push({"content": metaData.editor.content});  
    }

    return _.uniq(fields, function(item, index, list) {
        return item.name;
    });
  };
github pmarkert / hyperpotamus / lib / plugins / moment.js View on Github external
function manipulate(toManipulate, isAdd) {
	var date;
	if(_.isUndefined(toManipulate.date)) {
		date = moment();
	}
	else {
		// TODO - Handle error if the target value isn't a date
		date = moment(context.session[toManipulate.date]);
	}
	// TODO - handle error if .count is not a valid number
	var count = toManipulate.count || 1;
	// TODO - Check for missing/invalid interval
	if(isAdd) {
		return date.add(count, toManipulate.interval);
	}
	else {
		return date.subtract(count, toManipulate.interval);
	}
}
github zakandrewking / escher / src / Map.js View on Github external
function select_selectable(node, d, shift_key_on) {
  /** Select a metabolite or text label, and manage the shift key. */
  shift_key_on = _.isUndefined(shift_key_on) ? false : shift_key_on
  var classable_selection = this.sel.selectAll('#nodes,#text-labels')
    .selectAll('.node,.text-label'),
  classable_node
  if (d3_select(node).attr('class').indexOf('text-label') == -1) {
    // node
    classable_node = node.parentNode
  } else {
    // text-label
    classable_node = node
  }
  // toggle selection
  if (shift_key_on) {
    // toggle this node
    d3_select(classable_node)
      .classed('selected', !d3_select(classable_node).classed('selected'))
  } else {
github Azure / azure-xplat-cli / lib / commands / arm / insights / insights.alerts.actions.js View on Github external
insightsAlertsEmailActionsCommand._prepareAndExecuteEmailAction = function (options) {
    log.silly('options: ' + util.inspect(options));

    var customEmails;
    if (__.isString(options.customEmails)) {
      customEmails = options.customEmails.split(',');
    }
    else if (__.isArray(options.customEmails)) {
      customEmails = options.customEmails;
    } else if (__.isObject(options.customEmails)) {
      customEmails = __.toArray(options.customEmails);
    } else {
      throw new Error(util.format($('Incorect value for customEmails: %s'), options.customEmails));
    }

    if (!options.sendToServiceOwners && (__.isNull(customEmails) || __.isUndefined(customEmails) || customEmails.length < 1)) {
      throw new Error($('Either sendToServiceOwners must be set or at least one custom email must be present'));
    }

    var eMailAction = {
      customEmails: customEmails,
      sendToServiceOwners: options.sendToServiceOwners
    };

    if (options.json) {
      cli.output.json(eMailAction);
    } else {
      log.data(JSON.stringify(eMailAction).replace(/"/g, '\\"'));
    }
  };
github falconair / nodefix / handlers / sessionProcessor.js View on Github external
function sessionProcessor(isAcceptor, options) {
    
    var self = this;

    this.isAcceptor = isAcceptor;
    this.isInitiator = !isAcceptor;

    this.isDuplicateFunc = _.isUndefined(options.isDuplicateFunc)? function () {return false;} : options.isDuplicateFunc;
    this.isAuthenticFunc = _.isUndefined(options.isAuthenticFunc)? function () {return true;} : options.isAuthenticFunc;
    this.getSeqNums = _.isUndefined(options.getSeqNums)? function () { return {'incomingSeqNum': 1, 'outgoingSeqNum': 1 }; } : options.getSeqNums;
    this.datastore = _.isUndefined(options.datastore)? function () {} : options.datastore ;
    
    this.fixVersion = null;
    this.senderCompID = null;
    this.targetCompID = null;

    this.defaultHeartbeatSeconds = _.isUndefined(options.defaultHeartbeatSeconds)? "10" : options.defaultHeartbeatSeconds;

    this.sendHeartbeats = _.isUndefined(options.sendHeartbeats)? true : options.sendHeartbeats;
    this.expectHeartbeats = _.isUndefined(options.expectHeartbeats)? true : options.expectHeartbeats ;
    this.respondToLogon = _.isUndefined(options.respondToLogon)? true : options.respondToLogon;

    this.isLoggedIn = false;
    this.heartbeatIntervalID = "";
github Teradata / kylo / ui / ui-app / src / main / resources / static / js / feed-mgr / feeds / define-feed-ng2 / summary / profile / container / invalid / profile-invalid.component.ts View on Github external
this.loadingData = false;
        };

        const errorFn = (err: any) => {
            this.loadingService.resolve(ProfileInvalidComponent.topOfPageLoader);
            this.loadingData = false;
        };

        const promise = this.http.get(
            this.restUrlService.FEED_PROFILE_INVALID_RESULTS_URL(this.feedId),
            {
                params:
                    {
                        'processingdttm': this.processingdttm,
                        'limit': this.limit,
                        'filter': _.isUndefined(this.filter) ? '' : this.filter.objectShortClassType
                    }
            }).toPromise();
        return promise.then(successFn, errorFn);
    }
github CodeCatalyst / grunt-sketch / tasks / sketch.js View on Github external
task.parameters.forEach( function ( parameter ) {
				var value = parameter.value || options[ parameter.name ];
				if ( !validateCommandParameter( parameter, value ) ) {
					return null;
				}
				if ( !_.isUndefined( value ) ) {
					args.push( convertValue( value, parameter.convert ) );
				}
			} );
		}
github zapier / formatic / lib / core / field.js View on Github external
proto.default = function () {
    var field = this;

    if (!_.isUndefined(field.def.value)) {
      return util.copyValue(field.def.value);
    }

    if (!_.isUndefined(field.def.default)) {
      return util.copyValue(field.def.default);
    }

    if (!_.isUndefined(field.typePlugin().default)) {
      return util.copyValue(field.typePlugin().default);
    }

    return null;
  };
github CartoDB / carto.js / src / core / util.js View on Github external
_.each(requiredOpts, function (item) {
    if (_.isUndefined(actualOpts[item])) {
      throw new Error(
        item + ' is required' + (from ? ' to initialize ' + from : '')
      );
    }
  });
};