seqgen v1.0.8
SeqGen
A basic number sequence generator, verifier and formatter in TypeScript. Documentation is here, and usage examples are below.
Usage
SeqGen may be used like this in JavaScript:
const seqgen = require('seqgen')
const mySeq = new seqgen.Sequence(2, 20, 10)
console.log('My sequence:', mySeq.format())
// > My sequence: 2, 4, 6, 8, 10, 12, 14, 16, 18, 20
Or, with a change to the only the import, in TypeScript:
import * as seqgen from 'seqgen'
const mySeq = new seqgen.Sequence(2, 2, 10)
console.log('My sequence:', mySeq.format())
// > My sequence: 2, 4, 6, 8, 10, 12, 14, 16, 18, 20
The verify function works like this:
const seqgen = require('seqgen')
const mySeq = new seqgen.Sequence(2, 20, 10)
console.log(mySeq.verify([2, 4, 6, 8, 10, 12, 14, 16, 18, 20]))
// > true
console.log(mySeq.verify([2, 5, 6, 8, 10, 12, 14, 16, 18, 20]))
// > false
Building
Building SeqGen requires TypeScript 3.x.
To build SeqGen, first clone the GitHub repository:
git clone https://github.com/rocketicv/seqgen.git
Then, fetch dependencies:
npm install --dev
And finally, run:
npm run build
Testing
SeqGen supports unit tests using mocha
and chai
.
To run the tests, clone the repo and run:
npm install --dev
Followed by:
npm run test
Documentation
Documentation is hosted here on Github Pages, and in the docs/
folder.
To generate documentation for SeqGen using TypeDoc, clone the repo, install dev dependencies, and run:
npm run genDocs