Last active
April 5, 2016 22:20
-
-
Save zanza00/61eb04620ccdee630e67b340b2c08fe6 to your computer and use it in GitHub Desktop.
when it's passed an object take every value, strip spaces and return a string
This file contains hidden or 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
//uses Ramdajs | |
function f( object ) { | |
function opt( val ) { | |
return String(val) || 'None'; | |
} | |
return R.replace( /\s+|\.+|\,+/g, '' , R.join('', R.map( opt, R.values( object ) ) ) ) | |
} | |
var o = {a:"This prop has spaces",n:12.3, r:null, z:0, data:[1,2,3]} | |
f(o) //"Thisprophasspaces123null0123" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment