diff --git a/headers.js b/headers.js index 69f4439..e4d828f 100644 --- a/headers.js +++ b/headers.js @@ -2,15 +2,15 @@ var ZEROS = '0000000000000000000'; var ZERO_OFFSET = '0'.charCodeAt(0); var USTAR = 'ustar00'; -function clamp(index, len, defaultValue) { - if (typeof index !== 'number') return defaultValue; - index = ~~index; // Coerce to integer. - if (index >= len) return len; - if (index >= 0) return index; - index += len; - if (index >= 0) return index; - return 0; -} +var clamp = function(index, len, defaultValue) { + if (typeof index !== 'number') return defaultValue; + index = ~~index; // Coerce to integer. + if (index >= len) return len; + if (index >= 0) return index; + index += len; + if (index >= 0) return index; + return 0; +}; var toType = function(flag) { switch (flag) { diff --git a/test/extract.js b/test/extract.js index f40d060..6880cae 100644 --- a/test/extract.js +++ b/test/extract.js @@ -4,15 +4,15 @@ var fixtures = require('./fixtures'); var concat = require('concat-stream'); var fs = require('fs'); -function clamp(index, len, defaultValue) { - if (typeof index !== 'number') return defaultValue; - index = ~~index; // Coerce to integer. - if (index >= len) return len; - if (index >= 0) return index; - index += len; - if (index >= 0) return index; - return 0; -} +var clamp = function(index, len, defaultValue) { + if (typeof index !== 'number') return defaultValue; + index = ~~index; // Coerce to integer. + if (index >= len) return len; + if (index >= 0) return index; + index += len; + if (index >= 0) return index; + return 0; +}; test('one-file', function(t) { t.plan(3);