mirror of
https://github.com/ferrous-systems/embedded-trainings-2020.git
synced 2025-01-27 08:18:07 +00:00
a4ee38540d
We bundle markdown-it-kroki, which can add mermaid diagrams to marp slides using https://kroki.io.
18 lines
518 B
JavaScript
18 lines
518 B
JavaScript
'use strict';
|
|
|
|
function safeProperty(test, name, type, defaultValue) {
|
|
if (test == null || test == undefined) return defaultValue;
|
|
if (typeof test[name] !== type) return defaultValue;
|
|
if (typeof test[name] === "string" && test[name] === '') return defaultValue;
|
|
return test[name];
|
|
}
|
|
|
|
function safeChoice(test, candidates, defaultValue) {
|
|
return candidates.includes(test) ?
|
|
test : defaultValue;
|
|
}
|
|
function safeUrl(test) {
|
|
|
|
}
|
|
|
|
module.exports = { safeProperty, safeChoice };
|