Neverending Package Mountain
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

vqua-interpolate

1.0.32 • Public • Published

← back

Vqua interpolate

Replace variables from vqua text nodes.

Example

 
  const vquaInterpolate = require('vqua-interpolate')
 
  const nodes = [
    {
      type: TAG_TYPE,
      tag: 'div',
      props: {},
      childs: [
        'Hello {{ name }}, from {{ author }}!',
      ]
    }
  ]
 
  const interpolatedNodes =
    vquaInterpolate(nodes, {
      name: 'stranger',
      author: {
        type: TAG_TYPE,
        tag: 'span',
        props: {},
        childs: [
          'sun'
        ],
      }
    })
 
  // interpolatedNodes =>
  // 
  // {
  //   type: TAG_TYPE,
  //   tag: 'div',
  //   props: {},
  //   childs: [
  //     'Hello stranger, from ',
  //     {
  //       type: TAG_TYPE,
  //       tag: 'span',
  //       props: {},
  //       childs: [
  //         'sun'
  //       ],
  //     },
  //     '!',
  //   ]
  // }

Install

npm i vqua-interpolate

DownloadsWeekly Downloads

52

Version

1.0.32

License

ISC

Unpacked Size

7.92 kB

Total Files

11

Last publish

Collaborators

  • avatar