npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

commonform-markup-stringify

v1.0.0

Published

stringify a Common Form as Common Form markup

Downloads

6

Readme

var assert = require('assert')
var stringify = require('commonform-markup-stringify')

assert.equal(
  stringify({content: ['This is a test.']}),
  'This is a test.'
)

assert.equal(
  stringify({
    content: [
      'This agreement (this ',
      {definition: 'Agreement'},
      ') is between ',
      {blank: ''},
      ' and the ',
      {use: 'Company'},
      '. See ',
      {reference: 'Something'},
      '.'
    ]
  }),
  'This agreement (this ""Agreement"") is between [] and the' +
  ' <Company>. See {Something}.'
)

assert.equal(
  stringify({content: ['This paragraph has [brackets] in it.']}),
  'This paragraph has \\[brackets\\] in it.'
)

assert.equal(
  stringify({
    content: [
      'If you see:',
      {form: {content: ['a lion;']}},
      {form: {content: ['a tiger; or']}},
      {
        form: {
          content: [
            {form: {content: ['something scary;']}},
            {form: {content: ['like a bear']}}
          ]
        }
      },
      'then run!'
    ]
  }),
  [
    'If you see:',
    '',
    '    \\\\',
    '    a lion;',
    '    ',
    '',
    '    \\\\',
    '    a tiger; or',
    '    ',
    '',
    '    \\\\',
    '    ',
    '',
    '        \\\\',
    '        something scary;',
    '        ',
    '',
    '        \\\\',
    '        like a bear',
    '        ',
    '    ',
    '',
    'then run!'
  ]
  .join('\n')
)

var form = {
  content: [
    {
      heading: 'Definition',
      form: {
        content: [
          {definition: 'Change of Control'},
          ' means',
          {
            form: {
              content: [
                'a transaction or series of related transactions in' +
                ' which any "person" or "group" (within the meaning' +
                ' of Section 13(d) and 14(d) of the Securities' +
                ' Exchange Act of 1934, as amended), becomes the' +
                ' "beneficial owner" (as defined in Rule 13d-3' +
                ' under the Securities Exchange Act of 1934, as' +
                ' amended), directly or indirectly, of more than ',
                {blank: ''},
                ' of the outstanding voting securities of the ',
                {use: 'Company'},
                ' having the right to vote for the election of' +
                ' members of the ',
                {use: 'Company'},
                '\'s board of directors,'
              ]
            }
          },
          {
            form: {
              content: [
                'any reorganization, merger or consolidation of the ',
                {use: 'Company'},
                ', other than a transaction or series of related' +
                ' transactions in which the holders of the voting' +
                ' securities of the ',
                {use: 'Company'},
                ' outstanding immediately prior to such transaction' +
                ' or series of related transactions retain,' +
                ' immediately after such transaction or series of' +
                ' related transactions, at least a majority of the' +
                ' total voting power represented by the outstanding' +
                ' voting securities of the ',
                {use: 'Company'},
                ' or such other surviving or resulting entity or'
              ]
            }
          },
          {
            form: {
              content: [
                'a sale, lease or other disposition of all or' +
                ' substantially all of the assets of the ',
                {use: 'Company'},
                '.'
              ]
            }
          }
        ]
      }
    }
  ]
}

var parse = require('commonform-markup-parse')

assert.deepEqual(
  parse(stringify(form)).form,
  form
)