0.1.1 • Published 8 years ago

commonform-suspicious v0.1.1

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
8 years ago
var suspicious = require('commonform-suspicious')

The examples in this README are the package's test suite.

var assert = require('assert')

Deep Nesting

var deeplyNested = { content: [ 'A' ] }

for (var depth = 0; depth < 11; depth++) {
  deeplyNested = { content: [ { form: deeplyNested } ] } }

assert(suspicious(deeplyNested))

Long Defined Terms

var term = ( 'This defined term keeps going' + ' and going'.repeat(10) )

assert(suspicious({ content: [ { definition: term } ] }))

assert(suspicious({ content: [ { use: term } ] }))

Long Headings

var heading = ( 'This heading keeps going' + ' and going'.repeat(10) )

assert(suspicious({ content: [ { reference: heading } ] }))

assert(
  suspicious({
    content: [
      { heading: heading,
        form: { content: [ 'A' ] } } ] }))

Long Content Arrays

var longContentArray = [ ]
for (var index = 0; index < 300; index++) {
  if (index % 2) {
    longContentArray.push('X') }
  else {
    longContentArray.push({ use: 'Y' }) } }

assert(suspicious({ content: longContentArray }))

Long Words

var word = ( 'gobbledy' + 'obbledy'.repeat(10) + 'gook' )

assert(suspicious({ content: [ word ] }))
assert(!suspicious({ content: [ 'gobbledygook' ] }))
assert(!suspicious({ content: [ 'gobbledy gook' ] }))