@taktikorg/cumque-beatae-officiis

1.2.39 • Public • Published

@taktikorg/cumque-beatae-officiis

About the package

Small package to parse parameters in a string to set their corresponding values.

How to use the parser

To use the parser, import stringParametersParser from @taktikorg/cumque-beatae-officiis and then call the function getStringWithParameterValues. This function takes 3 arguments:

  • parameterSymbol: Which is the symbol use to identify a parameter in the string
  • baseString:: Which is the base string with unparsed parameters
  • parameters: Which is an object containing pairs of key and values for the different parameters contained in the base string

Example

import { stringParametersParser } from '@taktikorg/cumque-beatae-officiis';

const parameterSymbol = ':';
const baseString = 'Hello :target !';

console.log(
  stringParametersParser.getStringWithParameterValues(
    parameterSymbol,
    baseString,
    { target: 'world' },
  ),
); //Display: Hello world !
console.log(
  stringParametersParser.getStringWithParameterValues(
    parameterSymbol,
    baseString,
    { target: 'dear user' },
  ),
); //Display: Hello dear user !

Dependencies (42)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @taktikorg/cumque-beatae-officiis

    Weekly Downloads

    255

    Version

    1.2.39

    License

    MIT

    Unpacked Size

    36.9 kB

    Total Files

    65

    Last publish

    Collaborators

    • lechuongb878