Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/balanced-match

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/balanced-match

TypeScript definitions for balanced-match

  • 3.0.2
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Installation

npm install --save @types/balanced-match

Summary

This package contains type definitions for balanced-match (https://github.com/juliangruber/balanced-match).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/balanced-match.

index.d.ts

export interface Output {
    /**
     * The index of the first match of a
     */
    start: number;
    /**
     * The index of the matching b
     */
    end: number;
    /**
     * The preamble, a and b not included
     */
    pre: string;
    /**
     * The match, a and b not included
     */
    body: string;
    /**
     * The postscript, a and b not included
     */
    post: string;
}

/**
 * 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', '}']`
 */
export default function 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 array with indexes: `[ <a index>, <b index> ]`.
 */
export function range(a: string | RegExp, b: string | RegExp, str: string): [number, number] | undefined;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:04 GMT
  • Dependencies: none

Credits

These definitions were written by Piotr Błażejewicz.

FAQs

Package last updated on 06 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc