1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-18 23:07:45 +02:00

First pass at linting lib dir

This commit is contained in:
Laurent Cozic
2019-07-29 15:43:53 +02:00
parent 64b7bc3d62
commit 86dc72b204
170 changed files with 4140 additions and 3119 deletions

View File

@ -26,11 +26,11 @@ ObjectUtils.sortByValue = function(object) {
}
return output;
}
};
ObjectUtils.fieldsEqual = function(o1, o2) {
if ((!o1 || !o2) && (o1 !== o2)) return false;
if ((!o1 || !o2) && o1 !== o2) return false;
for (let k in o1) {
if (!o1.hasOwnProperty(k)) continue;
if (o1[k] !== o2[k]) return false;
@ -42,20 +42,22 @@ ObjectUtils.fieldsEqual = function(o1, o2) {
if (c1.length !== c2.length) return false;
return true;
}
};
ObjectUtils.convertValuesToFunctions = function(o) {
const output = {};
for (let n in o) {
if (!o.hasOwnProperty(n)) continue;
output[n] = () => { return typeof o[n] === 'function' ? o[n]() : o[n]; }
output[n] = () => {
return typeof o[n] === 'function' ? o[n]() : o[n];
};
}
return output;
}
};
ObjectUtils.isEmpty = function(o) {
if (!o) return true;
return Object.keys(o).length === 0 && o.constructor === Object;
}
};
module.exports = ObjectUtils;
module.exports = ObjectUtils;