Skip to content

Instantly share code, notes, and snippets.

@miku

miku/sft.md

Last active Aug 29, 2015
Embed
What would you like to do?
Simple File Transformations

Simple File Transformations

A simple file transformation describes the transformation of a file from one shape into another. Transformations are

  • expressed in JavaScript and
  • applied on each line of the input file.

The transformation script can use two global variables: in and out.

in contains a single line of the input file without a trailing newline. out should contain the desired output or null, if no output should be produced. in and out are strings.

The simplest transformation - the identity - is expressed as follows:

out = in

This concludes the specification.

Why?

It's fun. It's simple. It uses a well known dynamic programming language to express transformations.

Implementations

  • ottily, Golang (in and out are named input and output, though)
  • eachline.js, node.js (incomplete, but fast)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment