
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
Perhaps the smallest Javascript brainfuck interpreter
picobrain is a 250-byte Javascript brainfuck interpreter.
The library exports a generator function which yields on output.
var bf = require("picobrain")
bf("+++[>++++++++++<-]>+++."); // Yields "!"
You can also provide your own tape.
// Here, we specify that we want the interpreter to use a new `Uint8Array` as
// the tape. This will set the tape size to 20 and cause cell values to wrap on
// overflow/underflow.
// If no tape is provided, the interpreter will just use a new empty unbounded
// number array.
var tape = new Uint8Array(20);
bf("-", tape);
For the input command to work (,), you must provide a function which is to be
invoked on input:
function input() {
return window.prompt();
}
bf(",.", [], function() {
return window.prompt();
});
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, or fork the project and make your own API!
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.
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.
Please see the LICENSE file for license information.
FAQs
Tiny Javascript brainfuck interpreter
The npm package picobrain receives a total of 0 weekly downloads. As such, picobrain popularity was classified as not popular.
We found that picobrain 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
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.