• Stars
    star
    113
  • Rank 310,115 (Top 7 %)
  • Language
    TypeScript
  • Created over 5 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿš† Quickly try npm packages without writing boilerplate code.

npm-try

๐Ÿš† Quickly try npm packages without writing boilerplate code.

asciicast

Build Status Commitizen friendly npm latest version

npm-try provides a REPL interface for you to try NPM packages without writing any boilerplate code.

Simply run npm-try [packages ..] anywhere on the shell and npm-try will show a REPL interface which has all packages installed and assigned to variables.

Features

  • Super easy to use!
  • npm-try even defines variables for you
  • Top-level await support (requires Node.js >= 10)

Install

$ npm install -g npm-try-cli

Examples

Wanna try the capitalize method of lodash package?

$ npm-try lodash
โœ” const lodash = require('lodash')
> lodash.capitalize('hello world')
'Hello world'

Would like to try multiple packages at the same time?

$ npm-try lodash underscore
โœ” const lodash = require('lodash')
โœ” const underscore = require('underscore')
> lodash.first([1, 2, 3])
1
> underscore.first([1, 2, 3])
1

A previous version? You can specify versions with @ symbol (Missing the old days when the pluck still exists).:

$ npm-try lodash@3
โœ” const lodash = require('lodash')
> lodash.pluck
[Function: pluck]

Asynchronous operations? await is supported out-of-the-box. Let's try ioredis:

$ npm-try ioredis
โœ” const Redis = require('ioredis')
> const redis = new Redis()
undefined
> await redis.get('foo')
'123'

Create a Project

REPL is not enough sometimes when you want to write more code to test with packages. npm-try offers --out-dir/-o option to create a self-contained project so you can write your test code at the drop of a hat.

$ npm-try lodash -o try-lodash
โœ” Installing lodash...
โœ” The project created at /Users/luin/try-lodash

Limitations

Testing multiple versions of the same package is not supported. The following command will only have lodash@3 provided:

$ npm-try lodash@4 lodash@3
โœ” const lodash = require('lodash')
โœ” const lodash = require('lodash')
> lodash.VERSION
'3.10.1'

License

MIT

More Repositories

1

medis

๐Ÿ’ป Medis is a beautiful, easy-to-use Mac database management application for Redis.
JavaScript
11,605
star
2

readability

๐Ÿ“š Turn any web page into a clean view
HTML
2,480
star
3

wechat-export

๐Ÿ“ƒ Export WeChat chat histories to HTML files.
C
674
star
4

ranaly

๐Ÿ“ˆ An easy to use chart system
JavaScript
498
star
5

CodeGame

๐ŸŽฎ JavaScript AI tank game
JavaScript
349
star
6

express-promise

โค๏ธ Middleware for easy rendering of async Query results.
JavaScript
317
star
7

express-di

Dependency injection for Express applications
JavaScript
160
star
8

bazinga

๐Ÿ’ฅ The best all-in-one toolbox. Bazinga!
TypeScript
110
star
9

redis-book-assets

ใ€ŠRedisๅ…ฅ้—จๆŒ‡ๅ—ใ€‹็ฌฌไบ”็ซ ็จ‹ๅบไปฃ็ 
JavaScript
92
star
10

serialize

Serialize an object including it's function into a JSON.
JavaScript
79
star
11

superfetch

A super powerful node.js HTTP client with the support of promise.
JavaScript
77
star
12

Hits-the-mole

The Hits-the-mole game implemented in pure CSS
CSS
62
star
13

colortype

A responsive WordPress theme
PHP
38
star
14

OhMyPullRequests

๐Ÿš€ Access my pull requests from the menu bar
Swift
30
star
15

node_ranaly

Ranaly client library
JavaScript
19
star
16

express-mongoose

JavaScript
15
star
17

SwiftJSONFormatter

๐Ÿชž Formatter JSON delightfully.
Swift
15
star
18

teascript

Synchronous JavaScript
JavaScript
13
star
19

slicee

a CLI version of slicy.
Ruby
13
star
20

typo

ๅฆˆๅฆˆไปŽๆญคๅ†ไนŸไธๆ€•ๆˆ‘่พ“้”™ๅฑžๆ€ง๏ผˆๆ–นๆณ•๏ผ‰ๅไบ†๏ผ
JavaScript
12
star
21

dotQ

Yet another Q.
JavaScript
10
star
22

redis-book-v3-code

JavaScript
8
star
23

Tribbble

A Dribbble client for iPhone
Objective-C
7
star
24

blog

My blog
HTML
6
star
25

php-lugit-framework

็ฎ€ๅ•ไผ˜้›…็š„PHPๅ‰็ซฏๆก†ๆžถใ€‚
PHP
6
star
26

the-css-that-you-dont-know-about

ไฝ ไธ็Ÿฅ้“็š„ CSS
HTML
6
star
27

quicker-npm-run

Alternative to `npm run` with support for autocomplete.
JavaScript
4
star
28

scene

A tiny front-end framework designed with โค๏ธ
JavaScript
4
star
29

splitargs

Splitting Redis arguments as redis-cli
JavaScript
3
star
30

Suki

An elegant web framework for node.js
CoffeeScript
3
star
31

guokroup

ๅฐ†ๆžœๅฃณๆ‰€ๆœ‰ๅฐ็ป„็š„ๆœ€ๆ–ฐ่ดดๅญๆ˜พ็คบๅœจไธ€้กต
CoffeeScript
3
star
32

cheerio-tester

Test the cheerio selector online
JavaScript
3
star
33

sample-NSSplitViewControlller

Swift
2
star
34

buddybook

books for buddies.
JavaScript
1
star
35

superspider

A powerful and distributed spider library used to crawl the web with the API of jQuery
1
star
36

3-key

โŒจ๏ธ Personal key mapping for The Key.
C
1
star
37

SwiftPHPSerialization

Swift implementation of PHP's `serialize` and `unserialize`.
Swift
1
star
38

GameEngineSuki

A JavaScript Game Engine
CoffeeScript
1
star
39

express-sequelize

Adds Sequelize Promise support to Express rendering.
JavaScript
1
star
40

Threes-AI

A Threes! AI
CoffeeScript
1
star
41

dribbble

A full-featured Dribbble client for Node.js
JavaScript
1
star
42

my-first-ios-app

Swift
1
star
43

aqsort

An implementation of asynchronous quicksort in JavaScript
JavaScript
1
star