How to use the range-parser.Result function in range-parser

To help you get started, we’ve selected a few range-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / range-parser / range-parser-tests.ts View on Github external
import * as RangeParser from 'range-parser';

declare var console: { assert(b: boolean): void };

console.assert(RangeParser(200, `malformed`) === RangeParser.Result.invaild);
console.assert(RangeParser(200, `bytes=500-20`) === RangeParser.Result.unsatisifiable);

const range = RangeParser(1000, `bytes=0-499`);

if (typeof range !== 'number') {
    console.assert(range.type === `bytes`);
    console.assert(range.length === 1);
}
github DefinitelyTyped / DefinitelyTyped / range-parser / range-parser-tests.ts View on Github external
import * as RangeParser from 'range-parser';

declare var console: { assert(b: boolean): void };

console.assert(RangeParser(200, `malformed`) === RangeParser.Result.invaild);
console.assert(RangeParser(200, `bytes=500-20`) === RangeParser.Result.unsatisifiable);

const range = RangeParser(1000, `bytes=0-499`);

if (typeof range !== 'number') {
    console.assert(range.type === `bytes`);
    console.assert(range.length === 1);
}

range-parser

Range header field string parser

MIT
Latest version published 5 years ago

Package Health Score

71 / 100
Full package analysis

Popular range-parser functions