Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ndjson-uniq #29

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

ItsNickBarry
Copy link

I've added a new command: ndjson-uniq. It returns the first value with any given result when passed to an expression. It's a lot like ndjson-filter, but I don't know of a way to get the same behavior out of the existing commands.

@ItsNickBarry
Copy link
Author

I found another way to do this:

ndjson-reduce 'p.set.has(d) || p.results.push(d), p.set.add(d), p' \
              '{ set: new Set(), results: [] }' | \
ndjson-split 'd.results'

It's a bit inconvenient. I'm going to keep using ndjson-uniq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant