Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
Proposing update for parsing Float (#131)
Browse files Browse the repository at this point in the history
* Update custom-formats.js

* Edit test files to reflect changes in new parsing custom float format with Number.parseFloat(val)
  • Loading branch information
frbrkoala authored and noahdietz committed Apr 25, 2017
1 parent 8f58f80 commit 6bf388e
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 26 deletions.
8 changes: 6 additions & 2 deletions custom-formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/loadTest/compare/request/assert/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/loadTest/compare/request/expect/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/loadTest/compare/request/should/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/loadTest/compare/supertest/assert/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/loadTest/compare/supertest/expect/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/loadTest/compare/supertest/should/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/robust/compare/request/assert/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/robust/compare/request/expect/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/robust/compare/request/should/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/robust/compare/supertest/assert/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/robust/compare/supertest/expect/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down
8 changes: 6 additions & 2 deletions test/robust/compare/supertest/should/base-path-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ var customFormats = module.exports = function(zSchema) {
});

zSchema.registerFormat('float', function(val) {
// should parse
return Number.isInteger(val);
// better parsing for custom "float" format
if (Number.parseFloat(val)) {
return true;
} else {
return false;
}
});

zSchema.registerFormat('date', function(val) {
Expand Down

0 comments on commit 6bf388e

Please sign in to comment.