Last active
August 29, 2015 14:08
-
-
Save wavebeem/973fd3e0449a7acb9fca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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