0.0.1 • Published 1 year ago

srepl v0.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

SREPL

Save-Read-Eval-Print-Loop: The file is the REPL

REPLs are awesome. However, REPLs are a mode of programming: you open up a separate terminal window, load up some of the code, and iterate on the side. When things are sorted out in the REPL you pull them into the code.

With SREPL there's no extra window to manage. Each file is its own REPL: save the file, it is read and evaluated, and the results are printed alongside the code as comments. Close the session and the comments are removed.

Watch a demo →

Usage

SREPL is available on NPM:

npm install srepl

Add p ("print") calls to a module file:

import { p } from 'srepl'

p(['Hello', 'world'].join(', '))

And run the srepl watcher daemon:

npm run srepl

Save the module file and SREPL will evaluate and print out the value passed to p as a code comment:

import { p } from 'srepl'

p(['Hello', 'world'].join(', ')) //=> "Hello, world"

Keep iterating on your code and saving. New comments will be added automatically:

import { p } from 'srepl'

const s = p(['Hello', 'world'].join(', ')) //=> "Hello, world"
p(s.toUpperCase()) //=> "HELLO, WORLD"

When you are done, terminate the srepl session and all code comments will be scrubbed from the file:

import { p } from 'srepl'

const s = p(['Hello', 'world'].join(', '))
p(s.toUpperCase())
0.0.1

1 year ago