All Projects → borisdiakur → N_

borisdiakur / N_

Licence: mit
Node.js REPL with lodash

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to N

Dash
Functional programming library for PHP. Inspired by Underscore, Lodash, and Ramda.
Stars: ✭ 84 (-28.81%)
Mutual labels:  lodash
Scalakata2
Interactive Playground
Stars: ✭ 99 (-16.1%)
Mutual labels:  repl
Endbasic
BASIC environment with a REPL, a web interface, and RPi support written in Rust
Stars: ✭ 106 (-10.17%)
Mutual labels:  repl
Placeline Nextjs
HyperTrack Placeline web application sample using NextJS, Ant-Design, Styled-Components, and Heroku
Stars: ✭ 88 (-25.42%)
Mutual labels:  lodash
Ns Tracker
Library to keep track of changes to Clojure source files
Stars: ✭ 95 (-19.49%)
Mutual labels:  repl
Lodash Form Collector
a form collector powered by lodash that support any frontend framework.
Stars: ✭ 101 (-14.41%)
Mutual labels:  lodash
Kubeplay
kubeplay – a new way to interact with Kubernetes API from your terminal
Stars: ✭ 83 (-29.66%)
Mutual labels:  repl
Nodebook
Nodebook - Multi-Lang Web REPL + CLI Code runner
Stars: ✭ 1,521 (+1188.98%)
Mutual labels:  repl
Almond
A Scala kernel for Jupyter
Stars: ✭ 1,354 (+1047.46%)
Mutual labels:  repl
Kukulcan
A REPL for Apache Kafka
Stars: ✭ 103 (-12.71%)
Mutual labels:  repl
Evaluate
A version of eval for R that returns more information about what happened
Stars: ✭ 88 (-25.42%)
Mutual labels:  repl
Vue Typescript Music
🔥 基于 vue 全家桶 音乐项目(Music project) vue+typescript 实现 高仿 网易云音乐 移动端WebApp
Stars: ✭ 94 (-20.34%)
Mutual labels:  lodash
Utils.js
Fast, small and purely functional utility library
Stars: ✭ 102 (-13.56%)
Mutual labels:  lodash
Immutability Helper X
The library extends the kolodny/immutability-helper to support update data by path string, like the get/set in lodash.
Stars: ✭ 86 (-27.12%)
Mutual labels:  lodash
Cl Repl
A full-featured repl implementation designed to work with Roswell
Stars: ✭ 106 (-10.17%)
Mutual labels:  repl
Reactjs Crud Boilerplate
Live Demo
Stars: ✭ 83 (-29.66%)
Mutual labels:  lodash
Repl
REPL rewrite for Node.js ✨🐢🚀✨
Stars: ✭ 101 (-14.41%)
Mutual labels:  repl
Telegram Clonebot
Simple Bot to clone Google Drive Files (or Folders) to your Team Drive[or Normal Drive]. P.S This is not a Mirror Bot. Enjoy ✌🏻
Stars: ✭ 114 (-3.39%)
Mutual labels:  repl
Brain
An esoteric programming language compiler on top of LLVM based on Brainfuck
Stars: ✭ 112 (-5.08%)
Mutual labels:  repl
Babel Preset Edge
A centralized Babel Configuration for modern React development. (+TypeScript, FastAsync, Macros, ...)
Stars: ✭ 102 (-13.56%)
Mutual labels:  lodash

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_ >

Repl specificities

Commands

Some commands are available to facilitate some operations, and are host under .lodash repl command:

  • .lodash fp: switch to lodash/fp
  • .lodash vanilla: switch to vanilla lodash mode
  • .lodash reset: switch to initial lodash mode
  • .lodash swap: switch to the other lodash mode (vanilla/fp)
  • .lodash current: output current lodash flavor in use
  • .lodash version: output lodash version in use

and the .lodash help to have more details about lodash repl commands

__ as last evaluated expression

Special character _ refer to the lodash instance, and cannot hold value of last expression. To provide the same feature, __ was introduced:

n_ > 10 + 2
12
n_ > 'number '+ __
'number 12'

Configuration options

Aside --fp and --use_strict/--use-strict, some other options are available either as CLI flags, or via environment variables.(with a trailing _N_)

The two main feature you can control is History persistance and Prompt Theme.

Flag aliases Env variable Description Default
--history-path --history, history-file _N_HISTORY_PATH Location of repl history file ~/.n_repl_history
--prompt.symbol _N_PROMPT__SYMBOL Symbol to use as $ prompt >
--prompt.name _N_PROMPT__NAME Name for the prompt n_
--prompt.color.name _N_PROMPT__COLOR__NAME Color for prompt name n_ blue
--prompt.color.symbol _N_PROMPT__COLOR__SYMBOL Color for prompt symbol red
--prompt.color.flavor _N_PROMPT__COLOR__FLAVOR Color for section of prompt about lodash flavor in use cyan
--prompt.color.help _N_PROMPT__COLOR__HELP Color for section of prompt about lodash flavor in use green

About styling, valid colors are: black, red, green, yellow, blue, magenta, cyan, white,gray, and dim.


Enjoy! 🚀

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].