see https export interface export interface IRange { type { string } memberof offset : number ; type { string } memberof count ? : number ; } export param { IRange } iRange returns { string } export function rangeToString ( iRange ) { if ( iRange . offset < 0 ) { throw new RangeError ( `IRange.offset cannot be smaller than 0.` ) ; } if ( iRange . count && iRange . count <= 0 ) { throw new RangeError ( `IRange.count must be larger than 0. Leave it undefined if you want a range from offset to the end.` ) ; } return iRange . count ? `bytes=${ iRange . offset }-${ iRange . offset + iRange . count - 1 }` : `bytes=${ iRange . offset }-` ; }