Showing 25 of 85 total issues
Function _deepEquals
has a Cognitive Complexity of 54 (exceeds 8 allowed). Consider refactoring. Open
export function _deepEquals(a: any, b: any): boolean {
if (a === b) return true
if (Number.isNaN(a)) {
return Number.isNaN(b)
- 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 _deepJsonEquals
has a Cognitive Complexity of 33 (exceeds 8 allowed). Consider refactoring. Open
export function _deepJsonEquals(a: any, b: any): boolean {
if (a === b) return true
if (Number.isNaN(a)) {
a = null
- 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 _stringify
has a Cognitive Complexity of 31 (exceeds 8 allowed). Consider refactoring. Open
export function _stringify(obj: any, opt: StringifyOptions = {}): string {
if (obj === undefined) return 'undefined'
if (obj === null) return 'null'
if (typeof obj === 'function') return 'function'
if (typeof obj === 'symbol') return obj.toString()
- 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
LocalTime
has 61 functions (exceeds 50 allowed). Consider refactoring. Open
export class LocalTime {
private constructor(private $date: Date) {}
/**
* Parses input String into LocalDate.
Function _leven
has a Cognitive Complexity of 29 (exceeds 8 allowed). Consider refactoring. Open
export function _leven(first: string, second: string, limit?: number): number {
if (first === second || limit === 0) {
return 0
}
- 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 plus
has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring. Open
plus(num: number, unit: LocalDateUnit, mutate = false): LocalDate {
let { $day, $month, $year } = this
if (unit === 'week') {
num *= 7
- 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 _debounce
has a Cognitive Complexity of 26 (exceeds 8 allowed). Consider refactoring. Open
export function _debounce<T extends AnyFunction>(
func: T,
wait: number,
opt: DebounceOptions = {},
): T & Cancelable {
- 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 pRetry
has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring. Open
export async function pRetry<T>(
fn: (attempt: number) => Promise<T>,
opt: PRetryOptions = {},
): Promise<T> {
const {
- 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
LocalDate
has 55 functions (exceeds 50 allowed). Consider refactoring. Open
export class LocalDate {
private constructor(
private $year: number,
private $month: number,
private $day: number,
Function diff
has a Cognitive Complexity of 22 (exceeds 8 allowed). Consider refactoring. Open
diff(d: LocalDateInput, unit: LocalDateUnit): number {
d = LocalDate.of(d)
const sign = this.cmp(d)
if (!sign) return 0
- 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 endOf
has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring. Open
endOf(unit: LocalTimeUnit, mutate = false): LocalTime {
if (unit === 'second') return this
const d = mutate ? this.$date : new Date(this.$date)
d.setSeconds(59, 0)
- 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 _createPromiseDecorator
has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring. Open
export function _createPromiseDecorator<RES = any, PARAMS = any>(
cfg: PromiseDecoratorCfg<RES, PARAMS>,
decoratorParams: PARAMS = {} as any,
): MethodDecorator {
const { decoratorName } = cfg
- 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 countWords
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
function countWords(text: string, options: ReadingTimeOptions = {}): WordCountStats {
let words = 0
let start = 0
let end = text.length - 1
const isWordBound = options.wordBound || isAnsiWordBound
- 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 startOf
has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring. Open
startOf(unit: LocalTimeUnit, mutate = false): LocalTime {
if (unit === 'second') return this
const d = mutate ? this.$date : new Date(this.$date)
d.setSeconds(0, 0)
- 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 _AsyncMemo
has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring. Open
(opt: AsyncMemoOptions): MethodDecorator =>
(target, key, descriptor) => {
if (typeof descriptor.value !== 'function') {
throw new TypeError('Memoization can be applied only to methods')
}
- 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 pMap1
has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring. Open
async function pMap1<IN, OUT>(
items: IN[],
mapper: AbortableAsyncMapper<IN, OUT>,
errorMode: ErrorMode,
logger: CommonLogger | null,
- 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 commonLoggerMinLevel
has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring. Open
export function commonLoggerMinLevel(
logger: CommonLogger,
minLevel: CommonLogLevel,
mutate = false,
): CommonLogger {
- 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 pMapAll
has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring. Open
async function pMapAll<IN, OUT>(
items: IN[],
mapper: AbortableAsyncMapper<IN, OUT>,
errorMode: ErrorMode,
logger: CommonLogger | null,
- 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 pupa
has a Cognitive Complexity of 13 (exceeds 8 allowed). Consider refactoring. Open
export function pupa(template: string, data: any[] | AnyObject, opt: PupaOptions = {}): string {
if (typeof template !== 'string') {
throw new TypeError(`Expected a \`string\` in the first argument, got \`${typeof template}\``)
}
- 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
Consider simplifying this complex logical expression. Open
if (
!year ||
!month ||
month < 1 ||
month > 12 ||