Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ declare global {
}

Array.prototype.last = function () { //NOSONAR
return this.length !== 0 ? this[this.length - 1] : -1
return this.length !== 0 ? this[this.length - 1] : -1 //NOSONAR
}

/*
* const arr = [1, 2, 3];
* arr.last(); // 3
*/

export {}
export {} //NOSONAR
2 changes: 1 addition & 1 deletion src/main/java/g2601_2700/s2624_snail_traversal/solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Array.prototype.snail = function (rowsCount: number, colsCount: number): number[
* arr.snail(1,4); // [[1,2,3,4]]
*/

export {}
export {} //NOSONAR
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type Fn = (accum: number, curr: number) => number

function reduce(nums: number[], fn: Fn, init: number): number {
let accumulator = init
nums.forEach((num) => {
nums.forEach((num) => { //NOSONAR
accumulator = fn(accumulator, num)
})
return accumulator
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/g2601_2700/s2630_memoize_ii/solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function memoize(fn: Fn): Fn {

let value = fn(...args)

currentCache.set(args[args.length - 1], value)
currentCache.set(args[args.length - 1], value) //NOSONAR
return value
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/g2601_2700/s2631_group_by/solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ Array.prototype.groupBy = function <T>(fn: (item: T) => string) { //NOSONAR
* [1,2,3].groupBy(String) // {"1":[1],"2":[2],"3":[3]}
*/

export {}
export {} //NOSONAR
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ Function.prototype.callPolyfill = function (context, ...args): any { //NOSONAR
* increment.callPolyfill({count: 1}); // 2
*/

export {}
export {} //NOSONAR
2 changes: 1 addition & 1 deletion src/main/java/g2601_2700/s2694_event_emitter/solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class EventEmitter {

emit(eventName: string, args: any[] = []): any[] {
const res = []
this.eventMap.get(eventName)?.forEach((cb) => res.push(cb(...args)))
this.eventMap.get(eventName)?.forEach((cb) => res.push(cb(...args))) //NOSONAR
return res
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/g2701_2800/s2705_compact_object/solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type Obj = Record<any, any>
function compactObject(obj: Obj): Obj {
if (Array.isArray(obj)) {
let retArr = []
obj.forEach((e, idx) => {
obj.forEach((e, idx) => { //NOSONAR
if (e) {
retArr.push(compactObject(e))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Calculator {
}

divide(value: number): Calculator { //NOSONAR
if (value === 0) throw Error('Division by zero is not allowed')
if (value === 0) throw new Error('Division by zero is not allowed')
this.init /= value
return this
}
Expand Down