2.2.2 • Published 6 months ago

basic-repl v2.2.2

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

Super basic repl (read, eval, print, loop) for creating CLIs

Usage

repl(prefix, handler)

Example

import repl from 'basic-repl'
repl('> ', code => {
	//Eval input and log it
	console.log(eval(code))
})
repl('[server] ', msg => {
	//This repl is for our chat
	//(Let's assume you already made a function chat(){...})
	chat(msg)
	console.log('✓ Chat message sent')
})

You can switch between multiple repls you have created with Tab

Commonjs

// For compatibility, commonjs works slightly differently
//1. a space is appended to the end of the prefix
//2. the value returned by the function is logged (in ES6 you must console.log() it yourself)
require('basic-repl')('$', code => eval(code))
2.2.1

9 months ago

2.2.2

6 months ago

2.2.0

1 year ago

2.0.3

2 years ago

2.1.1

2 years ago

2.1.0

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.0.2

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago