Skip to content
Node.js REPL with lodash
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
test
.coveralls.yml
.eslintignore
.eslintrc
.gitignore
.npmignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
package-lock.json
package.json

README.md

n_

Node.js REPL with lodash

Build Status Coverage Status npm version JavaScript Style Guide

animated gif showing usage of n_

Why?

Sometimes we use the Node.js REPL interface to experiment with code. Wouldn’t it be great to have that interface with lodash required by default?

Installation

$ npm install -g n_

Usage

$ n_
n_ >

lodash is now attached to the REPL context as _, so just use it:

n_ > _.compact([0, 1, false, 2, '', 3]);
[ 1, 2, 3 ]
n_ >

FP mode

It is possible to use lodash’s functional programming variant lodash/fp:

$ n_ --fp
n_ > _.map(function(v) { return v * 2; }, [1, 2, 3]);
[ 2, 4, 6 ]
n_ >

Strict mode

It is possible to enable strict mode in Node.js >= 4.x:

$ n_ --use_strict
n_ >

Notes

Special character _

The behavior of assigning _ to the last evaluated expression is disabled, since lodash is already assigned to _.

History persistence

n_ stores its session history under ~/.n_repl_history.

Enjoy!

You can’t perform that action at this time.