mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 16:25:51 +01:00
Merge branch 'master' into next61
# Conflicts: # package-lock.json # package.json # src/public/app/components/note_context.js # src/public/app/services/open.js # src/public/app/widgets/buttons/note_actions.js # src/public/app/widgets/find_in_code.js # src/public/app/widgets/type_widgets/canvas.js # src/services/options.js
This commit is contained in:
@@ -29,13 +29,17 @@ function getOption(name) {
|
||||
/**
|
||||
* @returns {integer}
|
||||
*/
|
||||
function getOptionInt(name) {
|
||||
function getOptionInt(name, defaultValue = undefined) {
|
||||
const val = getOption(name);
|
||||
|
||||
const intVal = parseInt(val);
|
||||
|
||||
if (isNaN(intVal)) {
|
||||
throw new Error(`Could not parse '${val}' into integer for option '${name}'`);
|
||||
if (defaultValue === undefined) {
|
||||
throw new Error(`Could not parse '${val}' into integer for option '${name}'`);
|
||||
} else {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
return intVal;
|
||||
|
||||
Reference in New Issue
Block a user