borisdiakur / n_ Goto Github PK
View Code? Open in Web Editor NEWNode.js REPL with lodash
Home Page: https://www.npmjs.org/package/n_
License: MIT License
Node.js REPL with lodash
Home Page: https://www.npmjs.org/package/n_
License: MIT License
The _
character is special in the Node REPL. See nodejs.org/api/repl.html.
So that means after doing something like > 1 + 2
, which will produce 3
, the value of _
is 3
.
n_: 1.4.3
npm: 4.0.5
OS: Linux (Arch)
Running:
npm ls -g --depth 0
results in the following error:
npm ERR! extraneous: lodash3 ~/.nvm/versions/node/v7.2.1/lib/node_modules/n_/node_modules/lodash3
npm ERR! error in ~/.nvm/versions/node/v7.2.1/lib/node_modules/n_/node_modules/lodash3: ENOENT: no such file or directory, open '~/.nvm/versions/node/v7.2.1/lib/node_modules/n_/node_modules/lodash3/package.json'
This error doesn't occur with [email protected]. Something to do with this?
And other ES6 transpiler REPLs. I know it's not very open-source-spririted of me (not having a solution to share), but I love n_
so much I'm not sure I can use babel-node without babel-n_.
Using [email protected] and [email protected], (almost) any input results in this warning being printed:
DeprecationWarning: Calling an asynchronous function without callback is deprecated.
I was looking at trymodule and noticed it used repl.history
and thought it might be a good thing for n_
too.
I think some shells have a repl history baked in so not too sure if it's needed.
With the release of [Lodash 4.0]
, it will be nice to upgrade n_
to the latest release.
Also it will be nice to tag the n_
repo same as the lodash version.
Hey @borisdiakur love your library, but I think I'm doing something wrong, I can't get _.toInteger() to work, I get an error - when I install globally I think it's still doing lodash major v 3?
paul42$ npm install -g n_
npm WARN deprecated [email protected]: ⚠️ WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar
/Users/paul42/.nvm/versions/node/v8.7.0/bin/n_3 -> /Users/paul42/.nvm/versions/node/v8.7.0/lib/node_modules/n_/bin/n_3
/Users/paul42/.nvm/versions/node/v8.7.0/bin/n_ -> /Users/paul42/.nvm/versions/node/v8.7.0/lib/node_modules/n_/bin/n_
> [email protected] postinstall /Users/paul42/.nvm/versions/node/v8.7.0/lib/node_modules/n_
> npm pack lodash@^3 && targz extract lodash-3.*.tgz extraneous/lodash3
lodash-3.10.1.tgz
+ [email protected]
added 26 packages in 3.564s
paul42$ n_4
-bash: n_4: command not found
paul42$ n_3
n_ > _.toInteger('4')
TypeError: _.toInteger is not a function
at repl:1:3
at ContextifyScript.Script.runInContext (vm.js:59:29)
at REPLServer.defaultEval (repl.js:241:29)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at Array.onLine (repl.js:440:10)
at REPLServer.<anonymous> (/Users/paul42/.nvm/versions/node/v8.7.0/lib/node_modules/n_/lib/n_.js:75:12)
at REPLServer.wrapper (/Users/paul42/.nvm/versions/node/v8.7.0/lib/node_modules/n_/extraneous/lodash3/package/index.js:3592:19)
at emitOne (events.js:115:13)
at REPLServer.emit (events.js:210:7)
n_ >
let me know if there is a certain area I can look at to submit a pull request. thanks for the awesome library!
Local NodeJS version is v20.10.0:
$ node -v
v20.10.0
After installing:
npm install -g n_
Running n_
does not work, seems to show an error within the interactive session:
$ n_
n_ > Value of "this" must be of type nullish or must be the global object
I have a weird error: if I run a multi-line command in the REPL (one that causes the ...
prefix) and I run that command before I run any command containing _
, the binding to lodash gets lost somehow.
You should be able to repeat this behavior by starting n_
and immediately running the two commands found in this example. It should work with any arbitrary multi-line command, as long as that command occurs before any usage of _
.
If you run a command containing _
first, there is no problem. Is this expected behavior?
A deprecation warning is showing in node v12
(node:15107) [DEP0124] DeprecationWarning: REPLServer.rli is deprecated
Ref: https://nodejs.org/api/deprecations.html#deprecations_dep0124_using_replserver_rli
Usage: https://github.com/borisdiakur/n_/blob/master/lib/n_.js#L72
- var events = server.rli._events;
+ var events = server._events;
How to reproduce?
n_
globallyn_ --fp
It would be worth noting in the readme that the special REPL variable _
has been redirected to $
.
I'm using n_ 1.3.0 and Node 6.0.0.
Instead of being assigned to the most recent output (as it was in Node 5), the variable $
is simply assigned to lodash in Node 6.
n_ > 123
123
n_ > $ // should be 123
{ [Function: lodash]
templateSettings:
{ escape: /<%-([\s\S]+?)%>/g,
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
variable: '',
imports: { _: [Circular] } },
after: [Function: after],
...
}
The issue might be related to this change.
This isn't really an issue, but it might be worth noting in the README that running .clear
breaks the lodash binding. I found this SO answer to be helpful in understanding why this is: http://stackoverflow.com/a/18971406/270949
Great tool, by the way. Thanks for putting it together.
Unit tests would rock. For a reference grunt-lodash uses nodeunit.
Would be useful to be able to specify which lodash version n_
relies on, since I'm working on a project that still relies on version 3.10.1.
Not sure if that's possible (npm/npm#5499 may be relevant), but at the very least I'll probably just fork and patch for now 😄
when i am trying to install npm this error is showing up. I tried cleaning cache, deleting node_modules, reinstalling node.js and installing n_ package manually and the problem is still exist.
`npm pack lodash@^3 ; targz extract lodash-3.*.tgz extraneous/lodash3
npm ERR! addLocal Could not install C:\Users\Sinan\Desktop\creosafe\node_modules\n_;
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "pack" "lodash@3" ";" "targz" "extract" "lodash-3.*.tgz" "extraneous/lodash3"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! path C:\Users\Sinan\Desktop\creosafe\node_modules\n_;
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Sinan\Desktop\creosafe\node_modules\n_;'
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Users\Sinan\Desktop\creosafe\node_modules\n_;'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Sinan\Desktop\creosafe\node_modules\n_\npm-debug.log
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: npm pack lodash@^3 ; targz extract lodash-3.*.tgz extraneous/lodash3
npm ERR! Exit status 4294963238
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'npm pack lodash@^3 ; targz extract lodash-3.*.tgz extraneous/lodash3'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the n_ package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! npm pack lodash@^3 ; targz extract lodash-3.*.tgz extraneous/lodash3
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs n_
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls n_
npm ERR! There is likely additional logging output above. ``
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.