Socket
Socket
Sign inDemoInstall

reviewers-edition-parse

Package Overview
Dependencies
0
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    reviewers-edition-parse

parse reviewers edition numbers


Version published
Weekly downloads
542
decreased by-4.41%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Reviewers editions are a simple way to number editions of useful prose projects, like policy statements or legal terms.

Numbers

Each reviewers edition has up to four numbers.

  1. An edition number

  2. An update number

  3. A correction number

  4. A draft number

Every reviewers edition has an edition number. The edition number and any other numbers must be whole numbers, one or greater.

These numbers increase over time for new published versions of a project. Correction numbers restart at one for every new update, and update numbers restart at one for every new edition.

Meaning

How the authors of a project change edition numbers over time conveys advice to users of older editions about their changes.

  1. When authors recommend users review a new edition in its entirety to ensure it meets their needs, they increase the edition number.

    For example, if a working group rewrites the second edition of a form privacy notice from scratch, they will release the rewrite as the third edition of the form.

  2. When authors recommend users review at least the new or changed parts of a new edition, they increase the update number.

    For example, if the working group adds a new paragraph to the third edition of its form privacy notice on location data, they will release the expanded policy as the third edition, first update. If they later rephrase a paragraph on genetic privacy, the will release the updated policy as the third edition, second update.

  3. When authors make only typographic or other, minor corrections that users need not review, they increase the correction number.

    For example, if the working group corrects a spelling error in the second edition, first update of their form, they will release the corrected form as second edition, first update, first correction. If they later catch and correct a typographical error, the resulting edition will be the second edition, first update, second correction.

Authors can also use reviewers editions to mark drafts of a new edition, update, or correction editions to come.

For example, if the working group publishes two drafts of a second update to the third edition, those drafts will be the fourth edition, first draft and fourth edition, second draft.

This Package

This JavaScript package exports a single function that parses reviewers edition short code strings, returning structured representations of their components.

var parse = require('reviewers-edition-parse')

Examples

The following examples are also the test suite for the parser. The tests use Node.js' built-in assert module.

var assert = require('assert')

The simplest reviewers edition has only an edition number. This number is written followed by the lower-case letter "u". So "second edition" becomes 2e:

assert.deepStrictEqual(
  parse('2e'),
  { edition: 2 })

The fifth update to a second edition adds the number five followed by the lower-case letter "u". So "second edition, fifth update" becomes 2e5u.

assert.deepStrictEqual(
  parse('2e5u'),
  { edition: 2, update: 5 })

The seventh correction to that edition adds the number seven followed by the lower-case letter "c". So "second edition, fifth update, seventh correction" becomes 2e5u7c.

assert.deepStrictEqual(
  parse('2e5u7c'),
  { edition: 2, update: 5, correction: 7 })

The first draft of a new fourth edition would use the reviewers edition code for the fourth edition, followed by the number one and the lower-case letter "d". So "fourth edition, first draft" becomes 4e1d.

assert.deepStrictEqual(
  parse('4e1d'),
  { edition: 4, draft: 1 })

Reviewers editions can similarly describe various drafts of new updates and corrections. So "fourth edition, fifth update, first draft" becomes 4e5u1d.

assert.deepStrictEqual(
  parse('4e5u1d'),
  { edition: 4, update: 5, draft: 1 })

And "fourth edition, fifth update, eighth correction, first draft" becomes 4e5u8c1d.

assert.deepStrictEqual(
  parse('4e5u8c1d'),
  { edition: 4, update: 5, correction: 8, draft: 1 })

Modules

An array of names for the numbers of reviewers editions are packaged as a JSON file, and can be required separately.

assert.deepStrictEqual(
  require('reviewers-edition-parse/numbers'),
  [ 'edition', 'update', 'correction', 'draft' ])

The regular expression used to parse strings can be also be required separately.

var re = require('reviewers-edition-parse/regular-expression')
assert(re.test('1e'))

The match groups of the regular expression correspond to the order of number names.

var match = re.exec('1e2u3c4d')
assert.deepStrictEqual(match[1], '1')
assert.deepStrictEqual(match[2], '2')
assert.deepStrictEqual(match[3], '3')
assert.deepStrictEqual(match[4], '4')

Keywords

FAQs

Last updated on 24 Jan 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc