
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
page-label-generator
Advanced tools
The Page Label Generator is a module that automatically generates page labels for "book-like" objects in a variety of ways. See the example usage section below to see the variety of page labeling options such as roman numberals, back-to-front, foliation, and starting numbers.
The Page Label Generator was originally written by Jon Stroop for Plum. This project cleans up some code, adds tape as a testing framework, and publishes it as a npm module for easy inclusion into browser-based apps.
If you want to run this code in the browser as part of your app, you will need webpack and you will need to add the babel polyfill at the top of your entry script like so:
import babelPolyfill from 'babel-polyfill'
$ npm install
$ npm test
$ npm run lint
npm run compile
See the Webpack Demo project and the Tonic notebook.
Start a shell session:
$ babel-node
> let mod = require("./src/labelGen").default;
> let gen = mod.pageLabelGenerator();
> gen.next().value;
'1'
> gen.next().value;
'2'
> gen.next().value;
'3'
> let opts = { start: 1, unitLabel: "p. ", bracket: true}
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value;
'[p. 5]'
> gen.next().value;
'[p. 6]'
> gen.next().value;
'[p. 7]'
> gen.next().value;
'[p. 8]'
> let mod = require("./src/labelGen").default;
> let opts = { start: 42, method: "foliate", frontLabel: " r", backLabel: " v", unitLabel: "f. "};
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value;
'f. 42 r'
> gen.next().value;
'f. 42 v'
> gen.next().value;
'f. 43 r'
> gen.next().value;
'f. 43 v'
> let opts = { start: 42, method: "foliate", frontLabel: "r", backLabel: "v", startWith: "back", unitLabel: "f. ", bracket: true};
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value;
'[f. 42v]'
> gen.next().value;
'[f. 43r]'
> gen.next().value;
'[f. 43v]'
> gen.next().value;
'[f. 44r]'
> gen.next().value;
'[f. 44v]'
> let mod = require("./src/labelGen").default;
> let opts = { start: 'i', unitLabel: "p. "};
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value;
'p. i'
> gen.next().value;
'p. ii'
> gen.next().value;
'p. iii'
> gen.next().value;
'p. iv'
> let opts = { start: 'xlii', method: "foliate", backLabel: " (verso)", startWith: "back", unitLabel: "f. ", bracket: true};
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value;
'[f. xlii (verso)]'
> gen.next().value;
'[f. xliii]'
> gen.next().value;
'[f. xliii (verso)]'
> gen.next().value;
'[f. xliv]'
> gen.next().value;
'[f. xliv (verso)]'
> gen.next().value;
'[f. xlv]'
> let opts = { unitLabel: 'p. ', bracketOdds: true };
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value
'[p. 1]'
> gen.next().value
'p. 2'
> gen.next().value
'[p. 3]'
> gen.next().value
'p. 4'
> let opts = { unitLabel: 'p. ', bracketEvens: true };
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value
'p. 1'
> gen.next().value
'[p. 2]'
> gen.next().value
'p. 3'
> gen.next().value
'[p. 4]'
> let mod = require("./src/labelGen").default;
> let opts = { start: 42, twoUp: true}
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value
'42/43'
> gen.next().value
'44/45'
> gen.next().value
'46/47'
> gen.next().value
'48/49'
> let opts = { start: 42, unitLabel: "p. ", twoUp: true, twoUpSeparator: "-"}
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value
'p. 43-42'
> gen.next().value
'p. 45-44'
> gen.next().value
'p. 47-46'
> gen.next().value
'p. 49-48'
> let opts = { start: 42, method: "foliate", frontLabel: "a", backLabel: "b", startWith: "back", unitLabel: "f. ", bracket: true, twoUp: true, twoUpDir: "rtl"}
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value
'[f. 43a/42b]'
> gen.next().value
'[f. 44a/43b]'
> gen.next().value
'[f. 45a/44b]'
> gen.next().value
'[f. 46a/45b]'
> let opts = { twoUp: true, twoUpBracketRightOnly: true };
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value
'1/[2]'
> gen.next().value
'3/[4]'
> gen.next().value
'5/[6]'
> gen.next().value
'7/[8]'
> let opts = { twoUp: true, twoUpBracketLeftOnly: true };
> let gen = mod.pageLabelGenerator(opts);
> gen.next().value
'[1]/2'
> gen.next().value
'[3]/4'
> gen.next().value
'[5]/6'
> gen.next().value
'[7]/8'
🤯
FAQs
Page Label Generator
The npm package page-label-generator receives a total of 28 weekly downloads. As such, page-label-generator popularity was classified as not popular.
We found that page-label-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.