Skip to content

Latest commit

 

History

History
115 lines (86 loc) · 3.36 KB

README.md

File metadata and controls

115 lines (86 loc) · 3.36 KB

jisg

Implementations of select OEIS integer sequences in JavaScript, portially inspired by intseq.

NPM Version NPM Downloads Build Status Build Size Code Coverage Scrutinizer Code Quality GPL 3.0

Install

yarn add jisg

Usage

Build System

import {A000045} from 'jisg'
const generator = A000045()
for (let i=0; i<43; i++) {
   console.log(generator.next().value)
}

Node

const {A000045} = require('jisg')
for (const i of A000045()) {
  console.log(i)
}

Script Tags

<script src="https://unpkg.com/jisg"></script>
<script>
const generator = jisg.A000045()
setInterval(
  function() => {
    document.write(
      generator.next().value,
      ', '
    )
  },
  666
)
</script>

Demos on CodePen

Fibonacci Sequence (A000045)

Chart of A000045 with ECharts

Pascal's Triangle (A007318)

In Your Browser

Try with RunKit

Read the Docs

Documentation

CLI Commands

  • yarn install: Install dependencies
  • yarn dev: Run tests when source files are changed
  • yarn lint --fix: Lint with ESLint
  • yarn test: Run tests
  • yarn doc: Build documentation
  • yarn build: Production build
  • yarn prepublish: Prepare for publishing
  • yarn publish: Publish to npm

Feedback

Contributing

Adding a Sequence Generator

  1. Fork and clone your repo locally.
  2. Create the source file in src/oeis/ using the OEIS number (eg. "A000001.ts") and add an entry in index.ts.
  3. Implement the generator so that the test case passes (eg. yarn test -t A000001). If the test takes longer than 10 seconds, optimize or remove integers from the end of the sample until it takes less than 10 seconds.
  4. Check code style and test coverage with yarn prepublish and fix any issues.
  5. Push to GitHub and submit a pull request.

Sponsorship