Skip to content

Commit

Permalink
Merge pull request #1735 from pchaussalet/master
Browse files Browse the repository at this point in the history
Add parsing of formatted bytes size strings
  • Loading branch information
thibaultzanini committed Jun 22, 2016
2 parents 74ff354 + b0c65a9 commit 3f8cd6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/converter/bytes-converter.js
Expand Up @@ -5,7 +5,7 @@
*/
var Converter = require("./converter").Converter;
var _numericValueToString = require("./number-converter")._numericValueToString;
var _stringToNumericValue = require("./number-converter")._stringToNumericValue;
var _stringToNumericValue = require("./number-converter").stringToNumericValue;
var NUMERIC_SCALES_BINARY_ = require("./number-converter").NUMERIC_SCALES_BINARY_;
var isDef = require("./converter").isDef;

Expand Down Expand Up @@ -113,7 +113,7 @@ exports.BytesConverter = Converter.specialize( /** @lends BytesConverter# */ {
*/
revert: {
value: function (v) {
return v;
return stringToNumBytes(v);
}
}

Expand Down
8 changes: 8 additions & 0 deletions test/converter-spec.js
Expand Up @@ -161,6 +161,14 @@ describe("converter-spec", function () {
});
});

describe('Test parsing of formatted size string to bytes', function() {
it('should return the value corresponding to the string', function() {
var string = '1.2GB';
var result = bytesConverter.revert(string);
expect(result).toBe(1288490188.8);
});
});


describe("Test Date/time formatters", function () {
it("should format a date to the default mm/dd/yyyy format", function () {
Expand Down

0 comments on commit 3f8cd6c

Please sign in to comment.