npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hosejs

v1.3.0

Published

javascript pipe, jq alternative

Downloads

91

Readme

HoseJS CircleCI

npm

:tada: Data handling with ramda.js (version 1.3 or higher)

hosejs

100% code coverage.

You can transform JSON(or NOT) data with just JavaScript in terminal.

jq? javascript is clearly better option for people already use javascript.

Feature

Data handling with ramda.js (version 1.3 or higher)

You can use ramda.js

eg. http https://swapi.co/api/people/1/ | j -r "props(['name', 'height'])"
eg. http https://swapi.co/api/people/1/ | j -ramda "props(['name', 'height'])"
eg. http https://swapi.co/api/people/1/ | j "props(['name', 'height'])(_)"

Options

  • --file option provide you to apply pre-defined script first
  • --tab if result is Object, print JSON format with specified tab size (default: 2)

Install

npm -g install hosejs

Command

j or js

Usage

_ is everything you need to know

$ cat some.json | j '_.map(x => x.timestamp)'
$ cat some.json | j '_.map(x => x.timestamp)' --tab 4
$ cat some.json | j '_.map(x => x.timestamp)' --file pre.js --tab 2
$ cat some.json | j '_.map(x => x.timestamp)' > some.json
$ cat some.json | j '[_].map(x => x.some_property + '👍')[0]'
$ cat some.json | j '_.map(x => new Date(x.timestamp).toISOString())'
$ cat some.json | j --file preload.js '_.map(x => x.timestamp)'
$ http https://swapi.co/api/people/ | j 'Object.keys(_)'
$ http https://swapi.co/api/people/ | j '_.count'
$ http https://swapi.co/api/people/ | j '_.results.map(x => x.name)'
$ echo 'not json string \n !!' | j '_.split("\n")'
$ http https://swapi.co/api/people/1/ | j -r "props(['name', 'height'])"  
$ http https://swapi.co/api/people/1/ | j -ramda "props(['name', 'height'])"  
$ http https://swapi.co/api/people/1/ | j "props(['name', 'height'])(_)"

Inject script file

IIFE

// cw-oneline.js
(() => {
  const time = time => new Date(time).toISOString().slice(0, -5).replace('T', ' ')
  return _.map(x => `${time(x.timestamp)} ${x.message}`)
})()
cat downloaded-cw-log.json | j -f cw-oneline.js > deptno.latest.json

Hmm ... Is it easy to look upside down?

add _.reverse()

cat downloaded-cw-log.json | j -f cw-oneline.js '_.reverse()' > deptno.latest.json

License

MIT