Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abstract-numbering

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abstract-numbering - npm Package Compare versions

Comparing version 1.0.0-prerelease-1 to 1.0.0

.travis.yml

21

package.json
{
"name": "abstract-numbering",
"description": "validate abstract numberings of hierarchical document parts",
"version": "1.0.0-prerelease-1",
"author": {
"name": "Kyle E. Mitchell",
"email": "kyle@kemitchell.com",
"url": "http://kemitchell.com/"
},
"version": "1.0.0",
"author": "Kyle E. Mitchell <kyle@kemitchell.com> (https://kemitchell.com)",
"dependencies": {

@@ -15,6 +11,4 @@ "is-integer": "^1.0.4",

"devDependencies": {
"check-versions": "1.x",
"jscs": "^1.12.0",
"jshint": "^2.7.0",
"literate-assertions": "0.1.x"
"defence-cli": "^1.0.5",
"replace-require-self": "^1.1.0"
},

@@ -30,11 +24,6 @@ "keywords": [

"license": "Apache-2.0",
"main": "abstract-numbering.js",
"repository": "commonform/abstract-numbering.js",
"scripts": {
"check": "check-versions --check-module",
"lint": "jshint abstract-numbering.js && jscs abstract-numbering.js",
"pre-commit": "npm run lint && npm run check && npm run test",
"test": "literate-assertions < README.md | sed \"s!'abstract-numbering'!'./'!g\" | node",
"travis-ci": "npm run pre-commit"
"test": "defence -i javascript README.md | replace-require-self | node"
}
}

@@ -1,26 +0,27 @@

abstract-numbering.js
=====================
[![NPM version](https://img.shields.io/npm/v/abstract-numbering.svg)](https://www.npmjs.com/package/abstract-numbering)
[![build status](https://img.shields.io/travis/commonform/abstract-numbering.js.svg)](http://travis-ci.org/commonform/abstract-numbering.js)
Validate abstract numberings of hierarchical document parts.
Abstract numberings express how hierarchical document parts like outline sections, headings, or list items should be numbered, without rendering those numberings in any particular way. Other modules in the [`*-numbering` family](https://www.npmjs.com/search?q=-numbering) convert abstract numberings to strings in particular styles, like `"1.2"` or `"1(a)(v)"`.
Abstract numberings express how hierarchical document parts like
outline sections, headings, or list items should be numbered, without
rendering those numberings in any particular way. Other modules in
the [`*-numbering` family](https://www.npmjs.com/search?q=-numbering)
convert abstract numberings to strings in particular styles, like
`"1.2"` or `"1(a)(v)"`.
Each abstract numbering is an array of numbering components, describing first the top-most "parent" of the relevant document part and continuing down to the document part to be numbered itself.
Each abstract numbering is an array of numbering components, describing
first the top-most "parent" of the relevant document part and continuing
down to the document part to be numbered itself.
Here is an example of a numbering for the first of two elements at the very top level of a document:
Here is an example of a numbering for the first of two elements at the
very top level of a document:
```javascript
var validNumbering = require('abstract-numbering');
var assert = require('assert')
var firstExample = [
{
series: {number: 1, of: 1}, // More on series later.
element: {number: 1, of: 2} // "Element number 1 of 2"
}
];
validNumbering(firstExample); // === true
assert(
validNumbering(
[ { // More on series later.
series: { number: 1, of: 1 },
// "Element number 1 of 2"
element: { number: 1, of: 2 } } ]))
```

@@ -31,13 +32,11 @@

```javascript
var firstBadExample = [
{
series: {number: 1, of: 1},
element: {number: 0, of: 1} // 0, not 1
}
];
validNumbering(firstBadExample); // === false
assert(
!validNumbering(
[ { series: { number: 1, of: 1 },
// 0, not 1.
element: { number: 0, of: 1 } } ]))
```
Series are used to describe situations when numbering restarts in the middle of a document part. Consider the following structure:
Series are used to describe situations when numbering restarts in the
middle of a document part. Consider the following structure:

@@ -61,20 +60,14 @@ ```none

```javascript
var tigers = [
// The component for "First Major Heading"
{
// Numbering of headings does not restart, so there is one series.
series: {number: 1, of: 1},
element: {number: 1, of: 2}
},
// The component for "Tigers"
{
// There are two series here, the first for fruit and animals.
// "Tigers" is in the second series.
series: {number: 2, of: 2},
// There are three total elements, of which "Tigers" is second.
element: {number: 2, of: 3}
}
];
validNumbering(tigers); // === true
assert(
validNumbering(
[ // The component for "First Major Heading"
{ // Numbering of headings does not restart, so there is one series.
series: { number: 1, of: 1 },
element: { number: 1, of: 2 } },
// The component for "Tigers"
{ // There are two series here, the first for fruit and animals.
// "Tigers" is in the second series.
series: { number: 2, of: 2 },
// There are three total elements, of which "Tigers" is second.
element: { number: 2, of: 3 } } ]))
```
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc