Browse Source

Removes unused functions from util

mbroad/unittest/lib/shared
MacLeod Broad 7 years ago
parent
commit
429b63c996
No known key found for this signature in database GPG Key ID: F1B295D13C3CC9CF
1 changed files with 1 additions and 36 deletions
  1. +1
    -36
      lib/util.js

+ 1
- 36
lib/util.js View File

@ -30,25 +30,6 @@ exports.recursiveDOMDelete = function (DOMobject) {
} }
}; };
/**
* this function gives you a range between 0 and 1 based on the min and max values in the set, the total sum of all values and the current value.
*
* @param {number} min
* @param {number} max
* @param {number} total
* @param {number} value
* @returns {number}
*/
exports.giveRange = function (min, max, total, value) {
if (max == min) {
return 0.5;
}
else {
var scale = 1 / (max - min);
return Math.max(0, (value - min) * scale);
}
};
/** /**
* Test whether given object is a string * Test whether given object is a string
* @param {*} object * @param {*} object
@ -82,29 +63,13 @@ exports.isDate = function (object) {
}; };
/** /**
* Create a semi UUID
* source: http://stackoverflow.com/a/105074/1262753
* Create a UUID
* @return {string} uuid * @return {string} uuid
*/ */
exports.randomUUID = function () { exports.randomUUID = function () {
return uuid.v4(); return uuid.v4();
}; };
/**
* assign all keys of an object that are not nested objects to a certain value (used for color objects).
* @param {object} obj
* @param {number} value
*/
exports.assignAllKeys = function (obj, value) {
for (var prop in obj) {
if (obj.hasOwnProperty(prop)) {
if (typeof obj[prop] !== 'object') {
obj[prop] = value;
}
}
}
};
/** /**
* Copy property from b to a if property present in a. * Copy property from b to a if property present in a.

Loading…
Cancel
Save