quick tweaks to clamp.
This commit is contained in:
parent
4d31ce9d77
commit
a606c781a7
2 changed files with 18 additions and 18 deletions
|
@ -2,7 +2,7 @@ var ZEROS = '0000000000000000000';
|
|||
var ZERO_OFFSET = '0'.charCodeAt(0);
|
||||
var USTAR = 'ustar00';
|
||||
|
||||
function clamp(index, len, defaultValue) {
|
||||
var clamp = function(index, len, defaultValue) {
|
||||
if (typeof index !== 'number') return defaultValue;
|
||||
index = ~~index; // Coerce to integer.
|
||||
if (index >= len) return len;
|
||||
|
@ -10,7 +10,7 @@ function clamp(index, len, defaultValue) {
|
|||
index += len;
|
||||
if (index >= 0) return index;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
var toType = function(flag) {
|
||||
switch (flag) {
|
||||
|
|
|
@ -4,7 +4,7 @@ var fixtures = require('./fixtures');
|
|||
var concat = require('concat-stream');
|
||||
var fs = require('fs');
|
||||
|
||||
function clamp(index, len, defaultValue) {
|
||||
var clamp = function(index, len, defaultValue) {
|
||||
if (typeof index !== 'number') return defaultValue;
|
||||
index = ~~index; // Coerce to integer.
|
||||
if (index >= len) return len;
|
||||
|
@ -12,7 +12,7 @@ function clamp(index, len, defaultValue) {
|
|||
index += len;
|
||||
if (index >= 0) return index;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
test('one-file', function(t) {
|
||||
t.plan(3);
|
||||
|
|
Loading…
Reference in a new issue