Skip to content

Commit fb92f71

Browse files
committed
Remove the responsability of spec checking
Signed-off-by: Fabio José <[email protected]>
1 parent a2ae5b9 commit fb92f71

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

lib/formats/json/parser.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
var Spec02 = require("../../specs/spec_0_2.js");
1+
function JSONParser() {
22

3-
const spec02 = new Spec02();
4-
5-
function JSONParser(_spec) {
6-
this.spec = (_spec) ? _spec : new Spec02();
73
}
84

95
/**
@@ -45,13 +41,10 @@ function validate_spec(payload, spec) {
4541

4642
JSONParser.prototype.parse = function(payload) {
4743

48-
// Level 0 of validation: is that string? is that JSON?
49-
var valid0 = validate_and_parse_as_json(payload);
50-
51-
// Level 1 of validation: is that follow a spec?
52-
var valid1 = validate_spec(valid0, this.spec);
44+
//is that string? is that JSON?
45+
var valid = validate_and_parse_as_json(payload);
5346

54-
return valid1;
47+
return valid;
5548
}
5649

5750
module.exports = JSONParser;

0 commit comments

Comments
 (0)