aboutsummaryrefslogtreecommitdiff
path: root/src/background/usecases/parsers.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-04-30 14:00:07 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-05-02 11:14:19 +0900
commitc60d0e7392fc708e961614d6b756a045de74f458 (patch)
tree0b9a5fce1879e38a92d5dbb2915779aee0ad22d6 /src/background/usecases/parsers.js
parent257162e5b6b4993e1dff0d705ffa6f0d809033eb (diff)
Rename .js/.jsx to .ts/.tsx
Diffstat (limited to 'src/background/usecases/parsers.js')
-rw-r--r--src/background/usecases/parsers.js31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/background/usecases/parsers.js b/src/background/usecases/parsers.js
deleted file mode 100644
index 43c8177..0000000
--- a/src/background/usecases/parsers.js
+++ /dev/null
@@ -1,31 +0,0 @@
-const mustNumber = (v) => {
- let num = Number(v);
- if (isNaN(num)) {
- throw new Error('Not number: ' + v);
- }
- return num;
-};
-
-const parseSetOption = (word, types) => {
- let [key, value] = word.split('=');
- if (value === undefined) {
- value = !key.startsWith('no');
- key = value ? key : key.slice(2);
- }
- let type = types[key];
- if (!type) {
- throw new Error('Unknown property: ' + key);
- }
- if (type === 'boolean' && typeof value !== 'boolean' ||
- type !== 'boolean' && typeof value === 'boolean') {
- throw new Error('Invalid argument: ' + word);
- }
-
- switch (type) {
- case 'string': return [key, value];
- case 'number': return [key, mustNumber(value)];
- case 'boolean': return [key, value];
- }
-};
-
-export { parseSetOption };