mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-27 03:02:50 +00:00
Merge pull request #29783 from tlaziuk/range-parser
[range-parser] fix babel7's --isolatedModules recommended option
This commit is contained in:
commit
a7e3258535
11
types/range-parser/index.d.ts
vendored
11
types/range-parser/index.d.ts
vendored
@ -4,11 +4,11 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Returns `-1` when unsatisfiable and `-2` when syntactically invalid.
|
||||
*
|
||||
* When ranges are returned, the array has a "type" property which is the type of
|
||||
* range that is required (most commonly, "bytes"). Each array element is an object
|
||||
* with a "start" and "end" property for the portion of the range.
|
||||
*
|
||||
* @returns `-1` when unsatisfiable and `-2` when syntactically invalid, ranges otherwise.
|
||||
*/
|
||||
declare function RangeParser(size: number, str: string, options?: RangeParser.Options): RangeParser.Result | RangeParser.Ranges;
|
||||
|
||||
@ -27,10 +27,9 @@ declare namespace RangeParser {
|
||||
*/
|
||||
combine?: boolean;
|
||||
}
|
||||
const enum Result {
|
||||
invaild = -2,
|
||||
unsatisifiable = -1,
|
||||
}
|
||||
type ResultUnsatisfiable = -1;
|
||||
type ResultInvalid = -2;
|
||||
type Result = ResultUnsatisfiable | ResultInvalid;
|
||||
}
|
||||
|
||||
export = RangeParser;
|
||||
|
||||
@ -2,8 +2,8 @@ import RangeParser = require('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);
|
||||
console.assert(RangeParser(200, `malformed`) === -2);
|
||||
console.assert(RangeParser(200, `bytes=500-20`) === -1);
|
||||
|
||||
const range = RangeParser(1000, `bytes=0-499`);
|
||||
|
||||
|
||||
@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"range-parser-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user