Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thisyahlen/fix: Reduce of empty array with no initial value #8253

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
4 changes: 2 additions & 2 deletions packages/bot-skeleton/src/scratch/hooks/workspace_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Blockly.WorkspaceSvg.prototype.cleanUp = function (x = 0, y = 0, blocks_to_clean
const start = (column_index - 1) * blocks_per_column;
const fat_neighbour_block = root_blocks
.slice(start, start + blocks_per_column)
.reduce((a, b) => (a.getHeightWidth().width > b.getHeightWidth().width ? a : b));
.reduce((a, b) => (a.getHeightWidth().width > b.getHeightWidth().width ? a : b), null);

let position_x = cursor_x + fat_neighbour_block.getHeightWidth().width + Blockly.BlockSvg.MIN_BLOCK_X;
if (!is_import) {
Expand All @@ -166,7 +166,7 @@ Blockly.WorkspaceSvg.prototype.cleanUp = function (x = 0, y = 0, blocks_to_clean
const a_metrics = a.getRelativeToSurfaceXY().y + a.getHeightWidth().height;
const b_metrics = b.getRelativeToSurfaceXY().y + b.getHeightWidth().height;
return a_metrics > b_metrics ? a : b;
});
}, null);

original_cursor_y =
lowest_root_block.getRelativeToSurfaceXY().y +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const AccountWizard = props => {
...obj,
...values,
};
});
}, {});
};

const clearError = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const buildCurrenciesList = payout_currencies => {
};

export const getDefaultCurrency = (currencies_list, currency = '') => {
const supported_currencies = Object.values(currencies_list).reduce((a, b) => [...a, ...b]);
const supported_currencies = Object.values(currencies_list).reduce((a, b) => [...a, ...b], []);
const default_currency = supported_currencies.find(c => c.value === currency)
? currency
: supported_currencies[0].value;
Expand Down
2 changes: 1 addition & 1 deletion packages/indicators/src/utils/math.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const takeLast = (arr, n, field) => takeField(arr.slice(n > arr.length ?

export const sum = data => data.reduce((acc, x) => acc + x);

export const mean = data => data.reduce((a, b) => a + b) / data.length;
export const mean = data => data.reduce((a, b) => a + b, 0) / data.length;

export const stddev = data => {
const data_mean = mean(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const buildCurrenciesList = payout_currencies => {
};

export const getDefaultCurrency = (currencies_list, currency = '') => {
const supported_currencies = Object.values(currencies_list).reduce((a, b) => [...a, ...b]);
const supported_currencies = Object.values(currencies_list).reduce((a, b) => [...a, ...b], []);
const default_currency = supported_currencies.find(c => c.value === currency)
? currency
: supported_currencies[0].value;
Expand Down