Skip to content

Instantly share code, notes, and snippets.

@zanza00
Last active April 5, 2016 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zanza00/61eb04620ccdee630e67b340b2c08fe6 to your computer and use it in GitHub Desktop.
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
//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