UNPKG

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