JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q34021F
  • License MIT

Tiny Javascript brainfuck interpreter

Package Exports

  • picobrain

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 (picobrain) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

picobrain

npm npm Github file size GitHub

Perhaps the smallest Javascript brainfuck interpreter

picobrain is a 292-byte Javascript brainfuck interpreter.

Usage

var bf = require("picobrain")

bf("+++[>++++++++++<-]>+++."); // Returns "!"

Why

Why not?

This library is also an open codegolf challenge. Please feel free to submit pull requests if you're able to make the code even shorter!

Install, Build & Test

To install the package, use the standard NPM install command:

npm install picobrain

The package is hand-written, minified Javascript; therefore, no build process is required, and you can directly edit and execute the source!

An NPM script has been created for simplicity when running tests, which can be run from the command line as shown below:

npm test

picobrain uses the Tape library for testing.

Content Delivery Network (CDN)

The picobrain library can be imported via unpkg as shown below:

<script type="application/javascript">var module={};</script>
<script src="https://unpkg.com/picobrain/index.js"></script>
<script type="application/javascript">
  var bf = module.exports;
  // Library is imported as `bf`!
</script>

Be aware that picobrain is a CommonJS module and therefore uses module.exports; before importing the script, you will need to define module or use a CommonJS-compatible module loader.

License

Please see the LICENSE file for license information.