Skip to content

Instantly share code, notes, and snippets.

@wavebeem
Last active August 29, 2015 14:08
Show Gist options
  • Save wavebeem/973fd3e0449a7acb9fca to your computer and use it in GitHub Desktop.
Save wavebeem/973fd3e0449a7acb9fca to your computer and use it in GitHub Desktop.
// 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