Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
shahata committed Sep 29, 2024
1 parent 24402fc commit 9941bcc
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/2015/day22.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function playBoss(game) {

function memoize(fn) {
const memo = {};
return function (...x) {
return (...x) => {
const s = JSON.stringify(x);
return (memo[s] = memo[s] ?? fn(...x));
};
Expand Down
2 changes: 1 addition & 1 deletion src/2017/day18.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function getter(state, p) {
}
}

export function parse(input, ops2 = {}, debug) {
export function parse(input, ops2 = {}, debug = undefined) {
const ops = {
snd: p1 => state => (state.sound = getter(state, p1)),
set: (p1, p2) => state => (state[p1] = getter(state, p2)),
Expand Down
2 changes: 1 addition & 1 deletion src/2019/day14.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function part2(input) {

let mid = Math.floor((start + end) / 2);
let result = part1(input, mid);
while (result != value && start < end) {
while (result !== value && start < end) {
if (value < result) {
end = mid - 1;
} else if (value > result) {
Expand Down
2 changes: 1 addition & 1 deletion src/2019/day22.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function increment({ length, offset }, count, undo) {
}
}

export function part1(input, length = 10007, offset = 2019, undo) {
export function part1(input, length = 10007, offset = 2019, undo = undefined) {
const shuffles = input.split('\n').map(l => {
const match = l.match(/(increment|cut) (-?\d+)/);
if (match) {
Expand Down
8 changes: 4 additions & 4 deletions src/2019/day24.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ function getBugs2(lifez, x, y, z) {
if (y === 4) result.push(up[3][2]);
}
if (down) {
if (x == 2 && y === 1) result.push(...down[0]);
if (x == 2 && y === 3) result.push(...down[4]);
if (y == 2 && x === 1) result.push(...down.map(l => l[0]));
if (y == 2 && x === 3) result.push(...down.map(l => l[4]));
if (x === 2 && y === 1) result.push(...down[0]);
if (x === 2 && y === 3) result.push(...down[4]);
if (y === 2 && x === 1) result.push(...down.map(l => l[0]));
if (y === 2 && x === 3) result.push(...down.map(l => l[4]));
}
return result.filter(x => x === '#').length + getBugs(lifez[z], x, y);
}
Expand Down
2 changes: 1 addition & 1 deletion src/2022/day22.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function wrapLogic1(maze, pos) {
}

function wrapLogic2(squares, width) {
return function (maze, pos) {
return (maze, pos) => {
const offset = { x: pos.x % width, y: pos.y % width };
const mirror = { x: width - offset.x - 1, y: width - offset.y - 1 };
const [i, direction] = squares.find(
Expand Down
2 changes: 1 addition & 1 deletion src/2023/day12.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function memoize(fn) {
const memo = {};
return function (...x) {
return (...x) => {
const s = JSON.stringify(x);
return (memo[s] = memo[s] ?? fn(...x));
};
Expand Down

0 comments on commit 9941bcc

Please sign in to comment.