aboutsummaryrefslogtreecommitdiff
path: root/src/shared/commands/properties.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2018-01-11 20:07:25 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2018-01-11 20:07:25 +0900
commitdda4e7475cdd092d00441c7cd0ceb194ee5dee3d (patch)
treed1bd538de2efb8243a55d80ece4ed5a63feb058d /src/shared/commands/properties.js
parent22c34a0a6f9721fb9d907ab10de91cbbc40d6bbe (diff)
move commands to background action
Diffstat (limited to 'src/shared/commands/properties.js')
-rw-r--r--src/shared/commands/properties.js31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/shared/commands/properties.js b/src/shared/commands/properties.js
deleted file mode 100644
index 8a3213d..0000000
--- a/src/shared/commands/properties.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 parseProperty = (word, types) => {
- let [key, value] = word.split('=');
- if (!value) {
- 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 { parseProperty };