JSPM

golfy

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

    An aggressive JavaScript minifier for code golf

    Package Exports

    • golfy
    • golfy/src/index.js

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

    Readme

    An aggressive JavaScript minifier for code golf.


    golfy is a program that converts the input code into code optimized for code golf.

    Example

    The following code

    const fs = require('fs');
    const input = fs.readFileSync('/dev/stdin');
    console.log(input);

    can be transformed as follows

    console.log(require("fs").readFileSync(0))

    Goals

    The goals of this project are as follows:

    • Shorter code over stability
    • Optimization of the output over processing time
    • The shortest possible expression, even if it's hacky

    The things this project does not aim for:

    • Ensuring compatibility across various runtime environments and backward compatibility
    • Maintaining internal implementation consistency with the input code (as long as the same input produces the same output, it's fine)
    • Execution performance (code length takes priority)

    Usage

    [!WARNING]
    WIP project and is highly experimental and unstable.

    npm install -g golfy
    
    golfy code.js
    # or
    cat code.js | golfy