@xen-orchestra/template

0.1.0 • Public • Published

@xen-orchestra/template Build Status

Install

Installation of the npm package:

> npm install --save @xen-orchestra/template

Usage

Create a string replacer based on a pattern and a list of rules.

const myReplacer = compileTemplate('{name}_COPY_\{name}_{id}_%\%', {
  '{name}': vm => vm.name_label,
  '{id}': vm => vm.id,
  '%': (_, i) => i
})

const newString = myReplacer({
  name_label: 'foo',
  id: 42,
}, 32)

newString === 'foo_COPY_{name}_42_32%' // true

Development

# Install dependencies
> yarn

# Run the tests
> yarn test

# Continuously compile
> yarn dev

# Continuously run the tests
> yarn dev-test

# Build for production (automatically called by npm install)
> yarn build

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

ISC © Vates SAS

/@xen-orchestra/template/

    Package Sidebar

    Install

    npm i @xen-orchestra/template

    Weekly Downloads

    3

    Version

    0.1.0

    License

    ISC

    Unpacked Size

    4.82 kB

    Total Files

    4

    Last publish

    Collaborators

    • mlssfrncjrg
    • b-nollet
    • mathieura
    • florent.beauchamp
    • tgoettelmann
    • julien-f
    • marsaud
    • pdonias
    • olivierlambert
    • benjireis