Socket
Socket
Sign inDemoInstall

command-javascript

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    command-javascript

Js is a command utility to run javascript as a command in a simple way.


Version published
Maintainers
1
Install size
7.00 kB
Created

Readme

Source

js

Js is a command utility to run javascript as a command in a simple way.

Use cases

  • Run javascript in the fastest way posible preserving your code in the history.
  • Empower your shell scripting and trasladate your javascript knowledge to the shell.
  • Parse strings, use regexp, split, replace... using the same code everywhere.

Features

  • A pipedStdin global that holds piped input if provided from command line.
  • A run global function that allows you to run commands also inside your javascript code.
  • A loadFile function to load files in memory.
  • Small and portable. 80 lines of code and should work anywhere.
  • Only native node modules used, so you don't depend on versions and installs.

Examples

Run javascript: js 'console.log("Hello world")'

Work with piped streams: date | js 'console.log(pipedStdin.split(" ")[3])'

Fetch a remote resource and return the number of words js 'console.log(run("curl --silent http://example.com"))' | wc -w

Install

npm install --global command-javascript

Alternative Install

curl https://github.com/StringManolo/js/blob/c01e68feaaef521304fc7b5d073aec209243a311/bin/js -L > /usr/bin/js

Keywords

FAQs

Last updated on 12 Dec 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc