JSPM

  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q70202F
  • License GPL-3.0

Implementations of select OEIS integer sequences in JavaScript.

Package Exports

  • jisg

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jisg) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

jisg - JavaScript Integer Sequence Generators

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

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

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 (let 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>

CodePen Demo

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 cli: Start a command line interface
  • yarn lint: Lint with ESLint
  • yarn test: Run Jest and Enzyme tests
  • yarn clean: Delete previous build
  • yarn docs: Build documentation
  • yarn build: Production build
  • yarn build-all: Production build all the things
  • yarn prepublish: Prepare for publishing
  • yarn publish: Publish to npm

Feedback

Contributing

Adding a Sequence Generator

  1. Fork me and clone your repo locally.
  2. Copy the beginning of the sequence from The On-line Encyclopedia of Integer Sequences into a new entry in OEIS_START_SAMPLES in main.test.ts. Append an "n" to each integer to make them BigInts (/(\d+)/\1n/).
  3. Create the source file in src/oeis/ using the OEIS number (eg. "A000001.ts") and add an entry in main.ts.
  4. Implement the generator so that the test case passes (eg. yarn test -t A000001). If the test takes longer than 10 seconds, remove integers from the end of the sample until it takes less than 10 seconds.
  5. Check code style and test coverage with yarn prepublish and fix any issues.
  6. Push to GitHub and submit a pull request.
  7. Wait. 🙂