Camel case

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2018-12-15 11:55:39 -02:00
parent 9f9f758d18
commit 6daeaa971f
2 changed files with 23 additions and 23 deletions

View File

@ -1,6 +1,6 @@
var uuid = require("uuid/v4"); var uuid = require("uuid/v4");
function Spec_0_1(_caller){ function Spec01(_caller){
this.payload = { this.payload = {
cloudEventsVersion: "0.1", cloudEventsVersion: "0.1",
eventID: uuid() eventID: uuid()
@ -24,7 +24,7 @@ function Spec_0_1(_caller){
* *
* throw an error if do not pass. * throw an error if do not pass.
*/ */
Spec_0_1.prototype.check = function() { Spec01.prototype.check = function() {
if(!this.payload["eventType"]){ if(!this.payload["eventType"]){
throw {message: "'eventType' is invalid"}; throw {message: "'eventType' is invalid"};
@ -32,47 +32,47 @@ Spec_0_1.prototype.check = function() {
}; };
Spec_0_1.prototype.type = function(_type){ Spec01.prototype.type = function(_type){
this.payload["eventType"] = _type; this.payload["eventType"] = _type;
return this; return this;
}; };
Spec_0_1.prototype.eventTypeVersion = function(version){ Spec01.prototype.eventTypeVersion = function(version){
this.payload["eventTypeVersion"] = version; this.payload["eventTypeVersion"] = version;
return this; return this;
}; };
Spec_0_1.prototype.source = function(_source){ Spec01.prototype.source = function(_source){
this.payload["source"] = _source; this.payload["source"] = _source;
return this; return this;
}; };
Spec_0_1.prototype.id = function(_id){ Spec01.prototype.id = function(_id){
this.payload["eventID"] = _id; this.payload["eventID"] = _id;
return this; return this;
}; };
Spec_0_1.prototype.time = function(_time){ Spec01.prototype.time = function(_time){
this.payload["eventTime"] = _time.toISOString(); this.payload["eventTime"] = _time.toISOString();
return this; return this;
}; };
Spec_0_1.prototype.schemaurl = function(_schemaurl){ Spec01.prototype.schemaurl = function(_schemaurl){
this.payload["schemaURL"] = _schemaurl; this.payload["schemaURL"] = _schemaurl;
return this; return this;
}; };
Spec_0_1.prototype.contenttype = function(_contenttype){ Spec01.prototype.contenttype = function(_contenttype){
this.payload["contentType"] = _contenttype; this.payload["contentType"] = _contenttype;
return this; return this;
}; };
Spec_0_1.prototype.data = function(_data){ Spec01.prototype.data = function(_data){
this.payload["data"] = _data; this.payload["data"] = _data;
return this; return this;
}; };
Spec_0_1.prototype.addExtension = function(key, value){ Spec01.prototype.addExtension = function(key, value){
if(!this.payload["extensions"]){ if(!this.payload["extensions"]){
this.payload["extensions"] = {}; this.payload["extensions"] = {};
} }
@ -80,4 +80,4 @@ Spec_0_1.prototype.addExtension = function(key, value){
return this; return this;
}; };
module.exports = Spec_0_1; module.exports = Spec01;

View File

@ -1,7 +1,7 @@
var uuid = require("uuid/v4"); var uuid = require("uuid/v4");
var empty = require("is-empty") var empty = require("is-empty")
function Spec_0_2(){ function Spec02(){
this.payload = { this.payload = {
specversion: "0.2", specversion: "0.2",
id: uuid() id: uuid()
@ -11,7 +11,7 @@ function Spec_0_2(){
/* /*
* Check the spec constraints. * Check the spec constraints.
*/ */
Spec_0_2.prototype.check = function(){ Spec02.prototype.check = function(){
if(empty(this.payload["type"])) { if(empty(this.payload["type"])) {
throw {message: "'type' is invalid"}; throw {message: "'type' is invalid"};
@ -31,44 +31,44 @@ Spec_0_2.prototype.check = function(){
} }
} }
Spec_0_2.prototype.type = function(_type){ Spec02.prototype.type = function(_type){
this.payload["type"] = _type; this.payload["type"] = _type;
return this; return this;
} }
Spec_0_2.prototype.source = function(_source){ Spec02.prototype.source = function(_source){
this.payload["source"] = _source; this.payload["source"] = _source;
return this; return this;
} }
Spec_0_2.prototype.id = function(_id){ Spec02.prototype.id = function(_id){
this.payload["id"] = _id; this.payload["id"] = _id;
return this; return this;
} }
Spec_0_2.prototype.time = function(_time){ Spec02.prototype.time = function(_time){
this.payload["time"] = _time.toISOString(); this.payload["time"] = _time.toISOString();
return this; return this;
} }
Spec_0_2.prototype.schemaurl = function(_schemaurl){ Spec02.prototype.schemaurl = function(_schemaurl){
this.payload["schemaurl"] = _schemaurl; this.payload["schemaurl"] = _schemaurl;
return this; return this;
} }
Spec_0_2.prototype.contenttype = function(_contenttype){ Spec02.prototype.contenttype = function(_contenttype){
this.payload["contenttype"] = _contenttype; this.payload["contenttype"] = _contenttype;
return this; return this;
} }
Spec_0_2.prototype.data = function(_data){ Spec02.prototype.data = function(_data){
this.payload["data"] = _data; this.payload["data"] = _data;
return this; return this;
} }
Spec_0_2.prototype.addExtension = function(key, value){ Spec02.prototype.addExtension = function(key, value){
this.payload[key] = value; this.payload[key] = value;
return this; return this;
} }
module.exports = Spec_0_2; module.exports = Spec02;