News for hackers. Stuff that matters.
Re:Show HN: Jq alternative built on top of JavaScript anonym... by fiatjaf on Friday January 26, 2018 @05:52AM (#16238255)
I love jq and I wish I could write full programs using the jq funcional language, but this fx thing is great.

Mostly because its lack of learning curve, fx is much better positioned to be used by all people who don't love jq but just use it because there aren't other options.

Re:Show HN: Jq alternative built on top of JavaScript anonym... by medv on Friday January 26, 2018 @06:17AM (#16238341)
Thanks. It was the case.
Re:Show HN: Jq alternative built on top of JavaScript anonym... by andrvo on Monday January 29, 2018 @12:35PM (#16259054)
While jq is definitely faster, for more complex tasks I love using ramda-cli [1]. It has all the functions from the excellent Ramda [2] AND you can use LiveScript's [3] terser syntax (and pipes!).

Here's a quick command to output a list of recent files on Linux:

    xml2json < ~/.local/share/recently-used.xbel | ramda '.xbel.bookmark |> pluck \href |> map replace /file:\/\//, ""' -o raw
1. https://github.com/raine/ramda-cli 2. http://ramdajs.com/ 3. http://livescript.net/
Re:Show HN: Jq alternative built on top of JavaScript anonym... by andrvo on Monday January 29, 2018 @12:40PM (#16259105)
And here's a more interesting example using output from Algolia's search API:

   curl 'https://<redacted Algolia url>' | ramda '.hits |> map pick <[title url story_url objectID points num_comments]> |> evolve title: take 2 |> sort (.points) |> reverse'
Re:Show HN: Jq alternative built on top of JavaScript anonym... by stephenr on Friday January 26, 2018 @09:48AM (#16239536)
The whole reason for using jq in the first place is to handle json without needing to rely on a high level language runtime being available.
Re:Show HN: Jq alternative built on top of JavaScript anonym... by medv on Friday January 26, 2018 @11:08AM (#16240220)
Not convinced. I have nodejs on my machine AND I want to manipulate JSON in cli.
Re:Show HN: Jq alternative built on top of JavaScript anonym... by stephenr on Friday January 26, 2018 @01:14PM (#16241464)
I didn't say your reason. It's the reason the vast majority of people would use it.

It's even alluded to on the project homepage:

> jq is written in portable C, and it has zero runtime dependencies. You can download a single binary, scp it to a far away machine of the same type, and expect it to work.

Re:Show HN: Jq alternative built on top of JavaScript anonym... by medv on Friday January 26, 2018 @06:52PM (#16243881)
Done. =)

Now fx has standalone binary (linux, macos, win): https://github.com/antonmedv/fx/releases

Re:Show HN: Jq alternative built on top of JavaScript anonym... by helb on Monday January 29, 2018 @09:16AM (#16257575)
Now people are going to complain it's 1500x bigger than jq… :)

Thanks for this tool, i think i'll use it. Jq is great, but i can't do "advanced" operations without manual and/or Google. I use JS almost every day, so with Fx it's way easier (for me).

Re:Show HN: Jq alternative built on top of JavaScript anonym... by medv on Friday January 26, 2018 @02:16PM (#16242047)
I think, I can bundle fx with node into single bin for it =)
Re:Show HN: Jq alternative built on top of JavaScript anonym... by sd8dgf8ds8g8dsg on Friday January 26, 2018 @05:02AM (#16238058)
> Plain JavaScript

I don't agree this is a feature. An Javascript implementation of a command line tool is a terrible idea performance wise. There is good reasons jq is written in C.

Re:Show HN: Jq alternative built on top of JavaScript anonym... by medv on Friday January 26, 2018 @06:18AM (#16238344)
It's main feature actually. Zero learning curve. Everybody know JavaScript and when performance not important, "fx" is your choose.