mirror of
https://github.com/arx-research/libhalo.git
synced 2026-05-09 03:00:08 -04:00
24 lines
593 B
JavaScript
24 lines
593 B
JavaScript
/**
|
|
* LibHaLo - Programmatically interact with HaLo tags from the web browser, mobile application or the desktop.
|
|
* Copyright by Arx Research, Inc., a Delaware corporation
|
|
* License: MIT
|
|
*/
|
|
|
|
const {Action, ArgumentError} = require("argparse");
|
|
|
|
class JSONParseAction extends Action {
|
|
constructor() {
|
|
super(...arguments);
|
|
}
|
|
|
|
call(parser, namespace, values, option_string) {
|
|
try {
|
|
namespace[this.dest] = JSON.parse(values);
|
|
} catch (e) {
|
|
throw ArgumentError(this, e.message);
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = {JSONParseAction};
|