Options
All
  • Public
  • Public/Protected
  • All
Menu

Module source/parens

Index

Variables

Variables

Const parens

parens: { inside: (str: string) => string[]; remove: (str: string) => string; swap: (str: string, other: string) => string } = ...

Type declaration

  • inside: (str: string) => string[]
      • (str: string): string[]
      • Takes string and returns array of strings containing what was inside any number of sets of parenthesis

        Basic usage example:

        const parens = require('stringman').parens; // or `import {parens} from 'stringman'`;
        const fromInside = parens.inside('this is ignored (and this is returned)');
        console.log(fromInside); // 'this is returned'
        

        Parameters

        • str: string

        Returns string[]

  • remove: (str: string) => string
      • (str: string): string
      • Takes string and returns string with parenthesis and contain between parenthesis removed

        Basic usage example:

        const parens = require('stringman').parens; // or `import {parens} from 'stringman'`;
        const noParens = parens.remove('this will come back (and this will be removed)');
        console.log(noParens); // 'this will come back'
        

        Parameters

        • str: string

        Returns string

  • swap: (str: string, other: string) => string
      • (str: string, other: string): string
      • Takes 2 strings, swaps anything in parenthesis INCLUDING THE PARENTHESIS from the first string with the second string

        Basic usage example:

        const parens = require('stringman').parens; // or `import {parens} from 'stringman'`;
        const noParens = parens.swap('this has (stuff) in parens', 'things');
        const withParens = parens.swap('this has (other stuff) in parens too', '(more things)');
        console.log(noParens); // 'this has things in parens'
        console.log(withParens); // 'this has (more things) in parens too'
        

        Parameters

        • str: string
        • other: string

        Returns string

Generated using TypeDoc