Skip to content

add ndjson-uniq - #29

Open
ItsNickBarry wants to merge 3 commits into
mbostock:masterfrom
ItsNickBarry:ndjson-uniq
Open

add ndjson-uniq#29
ItsNickBarry wants to merge 3 commits into
mbostock:masterfrom
ItsNickBarry:ndjson-uniq

Conversation

@ItsNickBarry

Copy link
Copy Markdown

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
Copy Markdown
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 freeto 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

@ItsNickBarry