summaryrefslogtreecommitdiff
path: root/ui/lib/swatch/derive.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/lib/swatch/derive.js')
-rw-r--r--ui/lib/swatch/derive.js6
1 files changed, 1 insertions, 5 deletions
diff --git a/ui/lib/swatch/derive.js b/ui/lib/swatch/derive.js
index 85547e8..22ceb13 100644
--- a/ui/lib/swatch/derive.js
+++ b/ui/lib/swatch/derive.js
@@ -5,16 +5,12 @@ function tryDerive(args, func, fallback) {
try {
return func(...args);
} catch (e) {
- console.debug('deriver threw exception', e, func, args);
return fallback;
}
}
// A "deriver" is a function that never raises; if the underlying function would raise, the
// corresponding deriver instead returns a fallback value (or `undefined`).
-export function makeDeriver(func, fallback) {
+export function makeDeriver(func, fallback = undefined) {
return (...args) => tryDerive(args, func, fallback);
}
-
-// Some widely-used derivers, for convenience.
-export const json = makeDeriver(JSON.parse);