Showing 7 of 127 total issues
File eslinq.js
has 521 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ESLinq - LINQ for EcmaScript 2015
*
* An elegant way of working with ES6 iterables.
*
Sequence
has 48 functions (exceeds 20 allowed). Consider refactoring. Open
export class Sequence {
/**
* Creates a new `Sequence` instance wrapping the `iterable` specified.
*
* @param {Iterable} The `Iterable` to wrap.
Function union
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
union(other) {
ensureIsIterable(other, "`other` should be iterable");
const generator = function* () {
const seen = new Set();
- 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 count
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
count(matches) {
if (matches === undefined) {
// If the wrapped iterable is an `Array`, `Map` or `Set`,
// we can use these O(1) shortcuts to get the length.
if (this.iterable instanceof Array) {
- 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 join
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
join(inner, getOuterKey, getInnerKey, transform = defaultJoinTransform) {
ensureIsIterable(inner, "`inner` should be iterable");
ensureIsFunction(getOuterKey, "`getOuterKey` should be a function");
ensureIsFunction(getInnerKey, "`getInnerKey` should be a function");
ensureIsFunction(transform, "`transform` should be a function");
- 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 _elementAt
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_elementAt(index) {
const exhaustedResult = { element: undefined, exhausted: true },
valueResult = v => { return { element: v, exhausted: false }; };
// O(1) optimization for arrays
- 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 _single
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_single(matches = constantTrue) {
let found = false, item;
for (let i of this.iterable) {
if (matches(i)) {
- 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"