UNPKG

decimal-numbering

Version:

number hierarchical document parts like "Section 1.5.3"

19 lines (17 loc) 469 B
var alpha = require('lower-alpha') module.exports = function decimal (numbering, shortForm) { return ( (shortForm ? '' : 'Section\u00a0') + numbering .map(function (component) { var element = component.element var series = component.series return series.of > 1 ? (alpha(series.number) + '-' + element.number) : element.number }) .join('.') .toUpperCase() + (shortForm ? '.' : '') ) }