Use typeof instead of Underscore method

This commit is contained in:
Alfredo Sumaran 2016-08-19 18:52:21 -05:00
parent 255dbb3228
commit cf8efb462e
1 changed files with 2 additions and 2 deletions

View File

@ -470,7 +470,7 @@
} else {
if (!selected) {
value = this.options.id ? this.options.id(data) : data.id;
fieldName = _.isFunction(this.options.fieldName) ? this.options.fieldName() : this.options.fieldName;
fieldName = typeof this.options.fieldName === 'function' ? this.options.fieldName() : this.options.fieldName;
field = this.dropdown.parent().find("input[name='" + fieldName + "'][value='" + value + "']");
if (field.length) {
@ -545,7 +545,7 @@
selectedObject = this.renderedData[selectedIndex];
}
}
fieldName = _.isFunction(this.options.fieldName) ? this.options.fieldName(selectedObject) : this.options.fieldName;
fieldName = typeof this.options.fieldName === 'function' ? this.options.fieldName(selectedObject) : this.options.fieldName;
value = this.options.id ? this.options.id(selectedObject, el) : selectedObject.id;
if (isInput) {
field = $(this.el);