JSPM

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

suggest improvements to Common Forms

Package Exports

  • commonform-critique

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-critique) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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

assert.deepStrictEqual(
  critique({ content: [ 'to wit' ] })[0],
  [
    {
      message: 'The phrase "to wit" is archaic.',
      level: 'info',
      path: [ 'content', 0 ],
      source: 'commonform-archaic',
      url: null
    }
  ][0]
)

assert.deepStrictEqual(
  critique({ content: [ 'to witness' ] }),
  []
)

assert.deepStrictEqual(
  critique({ content: [ 'in order to' ] }),
  [
    {
      message: 'Replace "in order to" with "to".',
      level: 'info',
      path: [ 'content', 0 ],
      source: 'commonform-critique',
      url: null
    }
  ]
)

assert.deepStrictEqual(
  critique({ content: [ 'this /that' ] }),
  [
    {
      message: 'Remove the space before "/".',
      level: 'info',
      path: [ 'content', 0 ],
      source: 'commonform-critique',
      url: null
    }
  ]
)

assert.deepStrictEqual(
  critique({ content: [ 'this/ that' ] }),
  [
    {
      message: 'Remove the space after "/".',
      level: 'info',
      path: [ 'content', 0 ],
      source: 'commonform-critique',
      url: null
    }
  ]
)

assert.deepStrictEqual(
  critique({ content: [ { form: { content: [ 'this / that' ] } } ] }),
  [
    {
      message: 'Remove the space before "/".',
      level: 'info',
      path: [ 'content', 0, 'form', 'content', 0 ],
      source: 'commonform-critique',
      url: null
    },
    {
      message: 'Remove the space after "/".',
      level: 'info',
      path: [ 'content', 0, 'form', 'content', 0 ],
      source: 'commonform-critique',
      url: null
    }
  ]
)

assert.deepStrictEqual(
  critique({ content: [ 'Give me two (2) of those and four (4) of the other one.' ] }),
  [
    {
      message: '"two (2)" repeats a written number and numeral, which is redundant and error-prone',
      level: 'info',
      path: [ 'content', 0 ],
      source: 'doubleplus-numbers',
      url: null
    },
    {
      message: '"four (4)" repeats a written number and numeral, which is redundant and error-prone',
      level: 'info',
      path: [ 'content', 0 ],
      source: 'doubleplus-numbers',
      url: null
    }
  ]
)

assert.deepStrictEqual(
  critique({ content: [ 'Do not use any silly words whatsoever.' ] }),
  [
    {
      message: (
        'The phrase "whatsoever" should as a general matter be absent from your contracts.' +
        ' See MSCD appendix 2, pages 454-455.'
      ),
      level: 'info',
      path: [ 'content', 0 ],
      source: 'commonform-mscd',
      url: null
    }
  ]
)