lib/filter.js
Function filter
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var filter = function filter(terms) {
if (!Array.isArray(terms)) {
throw new Error("filter expects an array of terms");
}
Function _slicedToArray
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; })();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function tests
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var tests = (0, _flatmap.flatmap)(terms, function (_term) {
return Object.entries(_term).map(function (_ref) {
var _ref2 = _slicedToArray(_ref, 2);
var op = _ref2[0];
Function filter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
var filter = function filter(terms) {
if (!Array.isArray(terms)) {
throw new Error("filter expects an array of terms");
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"