commonform-substitute

1.1.0 • Public • Published

substitute terms and headings in Common Forms

var assert = require('assert')
var substitute = require('commonform-substitute')

assert.deepEqual(
  substitute(
    {
      content: [
        {
          heading: 'Banana',
          form: {
            content: [
              {definition: 'Apple'},
              {blank: ''}
            ]
          }
        },
        {
          heading: 'Rock',
          form: {
            content: [
              {use: 'Apple'},
              {reference: 'Banana'},
              {blank: ''}
            ]
          }
        }
      ]
    }, {
      terms: {'Apple': 'Orange'},
      headings: {'Banana': 'Pear'},
      blanks: {'2': 'Watermelon'}
    }
  ),
  {
    content: [
      {
        heading: 'Pear',
        form: {
          content: [
            {definition: 'Orange'},
            {blank: ''}
          ]
        }
      },
      {
        heading: 'Rock',
        form: {
          content: [
            {use: 'Orange'},
            {reference: 'Pear'},
            'Watermelon'
          ]
        }
      }
    ]
  }
)

Dependencies (0)

    Dev Dependencies (2)

    Package Sidebar

    Install

    npm i commonform-substitute

    Weekly Downloads

    3

    Version

    1.1.0

    License

    Apache-2.0

    Unpacked Size

    3.58 kB

    Total Files

    5

    Last publish

    Collaborators

    • kemitchell