Convert Service from class to function obj
Convert service from class to function object for consistency.  These
objects do not require the complexity of a ES6 class, as they have no
other behavior than creating data objects.
@@ -40,8 +40,15 @@ const argsToObject = coll => {
}, {});
};
-class Service {
- constructor(jsonSource) {
+ }
+ }
+};
+
+function Service(jsonSource) {
+ if (!(this instanceof Service)) {
+ return new Service(jsonSource);
+ }
+
if (jsonSource) {
this.serviceId = jsonSource.service_id;
this.serviceType = jsonSource.service_type;
@@ -54,7 +61,6 @@ class Service {
this.arguments = {};
}
}
-}
function Circuit(data) {
if (data.proposal_type) {
