JSPM

commonform-alex

0.3.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 10
  • Score
    100M100P100Q35425F
  • License Apache-2.0

Critique Common Forms for insensitive language

Package Exports

  • commonform-alex

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

Readme

commonform-alex

Critique contracts in Common Form for insensitive language using Alex.

var annotator = require('./index')
var assert = require('assert');

// Single tests

assert.deepEqual(
  annotator({ content: [ 'Hey bro!' ] }),
  [ { message: '\"bro\" may be insensitive',
        level: "info",
        path: [ 'content', 0 ],
        source: 'commonform-alex',
        url: null } ] )

assert.deepEqual(
  annotator({ content: [ 'What does she think?' ] }),
  [ { message: '\"she\" may be insensitive',
        level: "info",
        path: [ 'content', 0 ],
        source: 'commonform-alex',
        url: null } ] )

// Double test

assert.deepEqual(
  annotator({ content: [ 'What does she think about the bro?' ] }),
  [ { message: '\"she\" may be insensitive',
        level: "info",
        path: [ 'content', 0 ],
        source: 'commonform-alex',
        url: null },
    { message: '\"bro\" may be insensitive',
          level: "info",
          path: [ 'content', 0 ],
          source: 'commonform-alex',
          url: null } ] )

// Exclusion test

assert.deepEqual(
  annotator({ content: [ 'Talking about paternity is acceptable in family law cases, so we allow it.' ] }),
  [ ] )

// Many test

assert.deepEqual(
  annotator({ content: [ 'The boogeyman wrote all changes to the master server. Thus, the slaves were read-only copies of master. But not to worry, he was a cripple.' ] }),
  [ { message: '\"he\" may be insensitive',
        level: "info",
        path: [ 'content', 0 ],
        source: 'commonform-alex',
        url: null },
    { message: '\"boogeyman\" may be insensitive',
      level: "info",
      path: [ 'content', 0 ],
      source: 'commonform-alex',
      url: null },
    { message: '\"cripple\" may be insensitive',
      level: "info",
      path: [ 'content', 0 ],
      source: 'commonform-alex',
      url: null },
    { message: '\"master\" may be insensitive',
      level: "info",
      path: [ 'content', 0 ],
      source: 'commonform-alex',
      url: null },
    { message: '\"slaves\" may be insensitive',
      level: "info",
      path: [ 'content', 0 ],
      source: 'commonform-alex',
      url: null } ]);