Browse Source

lint lib (#3308)

revert-3409-performance
macleodbroad-wf 7 years ago
committed by Yotam Berkowitz
parent
commit
07e1af2873
2 changed files with 8 additions and 9 deletions
  1. +0
    -2
      lib/hammerUtil.js
  2. +8
    -7
      lib/util.js

+ 0
- 2
lib/hammerUtil.js View File

@ -1,5 +1,3 @@
var Hammer = require('./module/hammer');
/** /**
* Register a touch event, taking place before a gesture * Register a touch event, taking place before a gesture
* @param {Hammer} hammer A hammer instance * @param {Hammer} hammer A hammer instance

+ 8
- 7
lib/util.js View File

@ -141,7 +141,7 @@ exports.fillIfDefined = function (a, b, allowDeletion = false) {
* @param {... Object} b * @param {... Object} b
* @return {Object} a * @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++) { for (var i = 1; i < arguments.length; i++) {
var other = arguments[i]; var other = arguments[i];
for (var prop in other) { for (var prop in other) {
@ -158,7 +158,7 @@ exports.protoExtend = function (a, b) {
* @param {... Object} b * @param {... Object} b
* @return {Object} a * @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++) { for (var i = 1; i < arguments.length; i++) {
var other = arguments[i]; var other = arguments[i];
for (var prop in other) { for (var prop in other) {
@ -178,7 +178,7 @@ exports.extend = function (a, b) {
* @param {Object} b * @param {Object} b
* @return {Object} a * @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)) { if (!Array.isArray(props)) {
throw new Error('Array with property names expected as first argument'); throw new Error('Array with property names expected as first argument');
} }
@ -951,15 +951,16 @@ exports.hexToRGB = function (hex) {
* @returns {*} * @returns {*}
*/ */
exports.overrideOpacity = function (color, opacity) { exports.overrideOpacity = function (color, opacity) {
var rgb;
if (color.indexOf("rgba") != -1) { if (color.indexOf("rgba") != -1) {
return color; return color;
} }
else if (color.indexOf("rgb") != -1) { 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 + ")" return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + opacity + ")"
} }
else { else {
var rgb = exports.hexToRGB(color);
rgb = exports.hexToRGB(color);
if (rgb == null) { if (rgb == null) {
return color; return color;
} }
@ -967,7 +968,7 @@ exports.overrideOpacity = function (color, opacity) {
return "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + 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 high = orderedItems.length - 1;
var prevValue, value, nextValue, middle; 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 return a == b ? 0 : a < b ? -1 : 1
}; };

Loading…
Cancel
Save