Skip to content

Instantly share code, notes, and snippets.

@wavebeem
Last active Aug 29, 2015
Embed
What would you like to do?
// I suppose my thinking here is that `into` could take either a Lo-Dash
// pipeline object or a function. It seems feasible, but I definitely can't
// speak to performance implications. It also assumes that `pipeline` doesn't
// need to be terminated and that `into` ends method chains.
var handle = _.pipeline()
.mapValues(s => s.toLowerCase())
.into(p => p.first.charAt(0) + p.last)
var jdalton = { first: "John-David", last: "Dalton" }
var bmock = { first: "Brian", last: "Mock" }
var people = [jdalton, bmock]
var sortedHandles = _.pipeline()
.map(handle)
.sort()
.into(handles => handles.join(" "))
console.log(_(people).into(sortedHandles))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment