Skip to content

Latest commit

 

History

History
109 lines (73 loc) · 2.72 KB

README.md

File metadata and controls

109 lines (73 loc) · 2.72 KB

brnfckr, a brainfuck minifier written in JavaScript

Build status Dependency status

For an online demo, see mothereff.in/brainfuck-minifier.

Feel free to fork if you see possible improvements!

Installation and usage

Via npm:

npm install brnfckr

Via Bower:

bower install brnfckr

Via Component:

component install mathiasbynens/brnfckr

In a browser:

<script src="brnfckr.js"></script>

In Narwhal, Node.js, and RingoJS:

var brnfckr = require('brnfckr');

In Rhino:

load('brnfckr.js');

Using an AMD loader like RequireJS:

require(
  {
    'paths': {
      'brnfckr': 'path/to/brnfckr'
    }
  },
  ['brnfckr'],
  function(brnfckr) {
    console.log(brnfckr);
  }
);

Usage example:

var code = 'lol . wat + heh [ huh . hah + oh ] yay';
brnfckr.minify(code); // '.+[.+]'

Using the brnfckr binary

To use the brnfckr binary in your shell, simply install brnfckr globally using npm:

npm install -g brnfckr

After that you will be able to minify brainfuck programs from the command line:

$ brnfckr -c '.+[.+] prints out all ASCII characters'
.+[.+]
$ brnfckr -f foo.b
.+[.+]

See brnfckr --help for the full list of options.

Support

brnfckr has been tested in at least Chrome 27, Firefox 3-19, Safari 4-6, Opera 10-12, IE 6-10, Node.js v0.10.0, Narwhal 0.3.2, RingoJS 0.8-0.9, PhantomJS 1.9.0 and Rhino 1.7RC4.

Unit tests & code coverage

After cloning this repository, run npm install to install the dependencies needed for brnfckr development and testing. You may want to install Istanbul globally using npm install istanbul -g.

Once that’s done, you can run the unit tests in Node using npm test or node tests/tests.js. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use grunt test.

To generate the code coverage report, use grunt cover.

Author

twitter/mathias
Mathias Bynens

License

brnfckr is available under the MIT license.