Created
November 5, 2015 14:50
-
-
Save vinicius73/9383665c77fa425c5163 to your computer and use it in GitHub Desktop.
VueJS implode filter
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
Vue.filter('implode', function (value, piece, key) { | |
piece = piece ? piece : ', '; | |
if(_.isUndefined(key)) { | |
return value.join(piece); | |
} | |
return _.pluck(value, key).join(piece); | |
}); | |
// needs undescorejs // http://underscorejs.org/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment