@types/balanced-match

  • Version 3.0.2
  • Published
  • 5.46 kB
  • No dependencies
  • MIT license

Install

npm i @types/balanced-match
yarn add @types/balanced-match
pnpm add @types/balanced-match

Overview

TypeScript definitions for balanced-match

Index

Functions

function balanced

balanced: (
a: string | RegExp,
b: string | RegExp,
str: string
) => Output | undefined;
  • For the first non-nested matching pair of a and b in str, return an object with those keys: start the index of the first match of end the index of the matching b pre the preamble, a and b not included body the match, a and b not included post the postscript, a and b not included If there's no match, undefined will be returned. If the str contains more a than b / there are unmatched pairs, the first match that was closed will be used. For example, {{a} will match ['{', 'a', ''] and {a}} will match ['', 'a', '}']

function range

range: (
a: string | RegExp,
b: string | RegExp,
str: string
) => [number, number] | undefined;
  • For the first non-nested matching pair of a and b in str, return an array with indexes: [ <a index>, <b index> ].

Interfaces

interface Output

interface Output {}

    property body

    body: string;
    • The match, a and b not included

    property end

    end: number;
    • The index of the matching b

    property post

    post: string;
    • The postscript, a and b not included

    property pre

    pre: string;
    • The preamble, a and b not included

    property start

    start: number;
    • The index of the first match of a

    Package Files (1)

    Dependencies (0)

    No dependencies.

    Dev Dependencies (0)

    No dev dependencies.

    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/@types/balanced-match.

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