Debian Codegraph @

types-range-parser/README.md

raw
1 # Installation
2 > `npm install --save @types/range-parser`
3
4 # Summary
5 This package contains type definitions for range-parser (https://github.com/jshttp/range-parser).
6
7 # Details
8 Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/range-parser.
9 ## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/range-parser/index.d.ts)
10 ````ts
11 /**
12 * When ranges are returned, the array has a "type" property which is the type of
13 * range that is required (most commonly, "bytes"). Each array element is an object
14 * with a "start" and "end" property for the portion of the range.
15 *
16 * @returns `-1` when unsatisfiable and `-2` when syntactically invalid, ranges otherwise.
17 */
18 declare function RangeParser(
19 size: number,
20 str: string,
21 options?: RangeParser.Options,
22 ): RangeParser.Result | RangeParser.Ranges;
23
24 declare namespace RangeParser {
25 interface Ranges extends Array<Range> {
26 type: string;
27 }
28 interface Range {
29 start: number;
30 end: number;
31 }
32 interface Options {
33 /**
34 * The "combine" option can be set to `true` and overlapping & adjacent ranges
35 * will be combined into a single range.
36 */
37 combine?: boolean | undefined;
38 }
39 type ResultUnsatisfiable = -1;
40 type ResultInvalid = -2;
41 type Result = ResultUnsatisfiable | ResultInvalid;
42 }
43
44 export = RangeParser;
45
46 ````
47
48 ### Additional Details
49 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
50 * Dependencies: none
51
52 # Credits
53 These definitions were written by [Tomek Łaziuk](https://github.com/tlaziuk).