diff --git a/lib/hammerUtil.js b/lib/hammerUtil.js index caafb7dec..9a8f48928 100644 --- a/lib/hammerUtil.js +++ b/lib/hammerUtil.js @@ -1,5 +1,3 @@ -var Hammer = require('./module/hammer'); - /** * Register a touch event, taking place before a gesture * @param {Hammer} hammer A hammer instance diff --git a/lib/util.js b/lib/util.js index 5bef259f3..eb166694f 100644 --- a/lib/util.js +++ b/lib/util.js @@ -141,7 +141,7 @@ exports.fillIfDefined = function (a, b, allowDeletion = false) { * @param {... Object} b * @return {Object} a */ -exports.protoExtend = function (a, b) { +exports.protoExtend = function (a, b) { // eslint-disable-line no-unused-vars for (var i = 1; i < arguments.length; i++) { var other = arguments[i]; for (var prop in other) { @@ -158,7 +158,7 @@ exports.protoExtend = function (a, b) { * @param {... Object} b * @return {Object} a */ -exports.extend = function (a, b) { +exports.extend = function (a, b) { // eslint-disable-line no-unused-vars for (var i = 1; i < arguments.length; i++) { var other = arguments[i]; for (var prop in other) { @@ -178,7 +178,7 @@ exports.extend = function (a, b) { * @param {Object} b * @return {Object} a */ -exports.selectiveExtend = function (props, a, b) { +exports.selectiveExtend = function (props, a, b) { // eslint-disable-line no-unused-vars if (!Array.isArray(props)) { throw new Error('Array with property names expected as first argument'); } @@ -951,15 +951,16 @@ exports.hexToRGB = function (hex) { * @returns {*} */ exports.overrideOpacity = function (color, opacity) { + var rgb; if (color.indexOf("rgba") != -1) { return color; } else if (color.indexOf("rgb") != -1) { - var rgb = color.substr(color.indexOf("(") + 1).replace(")", "").split(","); + rgb = color.substr(color.indexOf("(") + 1).replace(")", "").split(","); return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + opacity + ")" } else { - var rgb = exports.hexToRGB(color); + rgb = exports.hexToRGB(color); if (rgb == null) { return color; } @@ -967,7 +968,7 @@ exports.overrideOpacity = function (color, opacity) { return "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + opacity + ")" } } -} +}; /** * @@ -1461,7 +1462,7 @@ exports.binarySearchValue = function (orderedItems, target, field, sidePreferenc var high = orderedItems.length - 1; var prevValue, value, nextValue, middle; - var comparator = comparator != undefined ? comparator : function (a, b) { + comparator = comparator != undefined ? comparator : function (a, b) { return a == b ? 0 : a < b ? -1 : 1 };