New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

bf-node

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bf-node

Brainfuck programming language interpreter for Node.js

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

bf-node

BF-Node is a lightweight interpreter of the Brainfuck programming language, written in JavaScript

The plain version of Brainfuck in the library weighs only 230 bytes

Usage

JavaScript

const Brainfuck = require("bf-node")
Brainfuck.base(/* code */, /* options */) // options are optional
Brainfuck.random(/* code */, /* options */)

Command line

bf <type> <path to file>

Types

base - The plain Brainfuck

random - Brainfuck with ? operator, generates a random number from 0 to current cell value and stores result in current cell

Options

Options is an array of functions

Default:

[
    t => new Uint8Array(t), // the function that makes the memory array, t is the length input
    String.fromCharCode, // the function that turns numbers into characters
    s => s.charCodeAt(), // the function that turns characters into numbers
    t => process.stdout.write(t), // the function that outputs the result
    () => ReadlineSync.question("> ", {
        limit: input => input.length == 1,
        limitMessage: ""
    }) // the function that receives the input
]

Performance

100 million + operations took on average 570ms to complete

100 million - operations took on average 600ms to complete

File sizes

base - 230 bytes

random - 279 bytes

Keywords

bf

FAQs

Package last updated on 29 Apr 2024

Did you know?

Socket

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.

Install

Related posts