JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15
  • Score
    100M100P100Q45950F
  • License BlueOak-1.0.0

normalize Common Forms

Package Exports

  • commonform-normalize

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (commonform-normalize) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Produces a digest-to-object map with an extra .root property containing the digest of the root of the Common Form.

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

assert.deepStrictEqual(
  normalize({
    content: [
      { heading: 'A', form: { content: ['A'] } },
      { heading: 'B', form: { content: ['B'] } }
    ]
  }),
  {
    root: 'd7069b8b7bc3897bd2f887830b16683546ab69231d23dbc0fed127df3defacc1',
    'eb94d16f10023fe29cb75d02a60eb531ffedcc7bdf7cc9aba8c25c962116b1f9': {
      content: [ 'A' ]
    },
    '5e5d60591967ee74ef2d324abc4b448578a186f26647f2aaa7249298696e6f22': {
      content: [ 'B' ]
    },
    'd7069b8b7bc3897bd2f887830b16683546ab69231d23dbc0fed127df3defacc1': {
      content: [
        {
          heading: 'A',
          digest: 'eb94d16f10023fe29cb75d02a60eb531ffedcc7bdf7cc9aba8c25c962116b1f9'
        },
        {
          heading: 'B',
          digest: '5e5d60591967ee74ef2d324abc4b448578a186f26647f2aaa7249298696e6f22'
        }
      ]
    }
  }
)