Showing 18 of 22 total issues
Function css
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const css = function(key, value) {
let styleProps, prop, val;
if(typeof key === 'string') {
- 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 append
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const append = function(element) {
if(this instanceof Node) {
if(typeof element === 'string') {
this.insertAdjacentHTML('beforeend', element);
} else {
- 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 after
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const after = function(element) {
if(this instanceof Node) {
if(typeof element === 'string') {
this.insertAdjacentHTML('afterend', element);
} else {
- 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 before
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const before = function(element) {
if(this instanceof Node) {
if(typeof element === 'string') {
this.insertAdjacentHTML('beforebegin', element);
} else {
- 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 domtastic
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const domtastic = function domtastic(selector, context = document) {
let collection;
if(!selector) {
- 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 prepend
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export const prepend = function(element) {
if(this instanceof Node) {
if(typeof element === 'string') {
this.insertAdjacentHTML('afterbegin', element);
} else {
- 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 on
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const on = function(eventNames, selector, handler, useCapture, once) {
if(typeof selector === 'function') {
handler = selector;
selector = null;
Function off
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const off = function(eventNames = '', selector, handler, useCapture) {
if(typeof selector === 'function') {
handler = selector;
selector = null;
Function querySelector
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const querySelector = (selector, context) => {
const isSimpleSelector = reSimpleSelector.test(selector);
if(isSimpleSelector) {
- 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 css
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const css = function(key, value) {
let styleProps, prop, val;
if(typeof key === 'string') {
Function closest
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const closest = (() => {
const closest = function(selector, context) {
const nodes = [];
each(this, node => {
Function on
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export const on = function(eventNames, selector, handler, useCapture, once) {
Function delegateHandler
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const delegateHandler = function(selector, handler, event) {
const eventTarget = event._target || event.target;
const currentTarget = closest.call([eventTarget], selector, this)[0];
if(currentTarget && currentTarget !== this) {
if(currentTarget === eventTarget || !(event.isPropagationStopped && event.isPropagationStopped())) {
- 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 getEventConstructor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getEventConstructor = type => isSupportsOtherEventConstructors ? (reMouseEvent.test(type) ? MouseEvent : (reKeyEvent.test(type) ? KeyboardEvent : CustomEvent)) : CustomEvent;
- 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 augmentEvent
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const augmentEvent = event => {
if(!event.isDefaultPrevented || event.stopImmediatePropagation || event.stopPropagation) {
for(const methodName in eventMethods) {
(function(methodName, testMethodName, originalMethod) {
event[methodName] = 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 attr
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const attr = function(key, value) {
if(typeof key === 'string' && typeof value === 'undefined') {
const element = this.nodeType ? this : this[0];
return element ? element.getAttribute(key) : undefined;
- 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 data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const data = function(key, value) {
if(typeof key === 'string' && typeof value === 'undefined') {
const element = this.nodeType ? this : this[0];
return element && DATAKEYPROP in element ? element[DATAKEYPROP][camelize(key)] : undefined;
- 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 toggleClass
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const toggleClass = function(value, state) {
if(value && value.length) {
const action = typeof state === 'boolean' ? state ? 'add' : 'remove' : 'toggle';
each(value.split(' '), _each.bind(this, action));
}
- 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"