range-parser

  • Version 2.0.0
  • Published
  • 24.2 kB
  • No dependencies
  • MIT license

Install

npm i range-parser
yarn add range-parser
pnpm add range-parser

Overview

Range header field string parser

Index

Functions

function combineRanges

combineRanges: (ranges: readonly Range[]) => readonly RangeWithIndex[];
  • Combine overlapping & adjacent ranges.

function format

format: (obj: Pick<Result, 'type' | 'ranges'>) => string;
  • Format normalized ranges as a "Range" header value.

function parse

parse: (size: number, str: string) => Result;
  • Parse "Range" header str relative to the given file size.

Interfaces

interface Range

interface Range {}
  • Range object contains normalized start and end positions.

property end

end: number;

    property start

    start: number;

      interface RangeWithIndex

      interface RangeWithIndex extends Range {}

        property index

        index: number;

          interface Result

          interface Result {}
          • Result object contains a status code, type, and array of Range objects.

          property code

          code: number;

            property ranges

            ranges: readonly Range[];

              property type

              type: string;

                Package Files (1)

                Dependencies (0)

                No dependencies.

                Dev Dependencies (4)

                Peer Dependencies (0)

                No peer dependencies.

                Badge

                To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/range-parser.

                • Markdown
                  [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/range-parser)
                • HTML
                  <a href="https://www.jsdocs.io/package/range-parser"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>