Skip to content

Instantly share code, notes, and snippets.

@keyserfaty
Created December 2, 2016 16:44
Show Gist options
  • Save keyserfaty/6bfffed7a74855342f0e7f15576e91a2 to your computer and use it in GitHub Desktop.
Save keyserfaty/6bfffed7a74855342f0e7f15576e91a2 to your computer and use it in GitHub Desktop.
Some fn in Javascript vs Ramda
import { when, equals, always, __ } from 'ramda'
//* Return a value when a certain value is provided
const parseTitleRamda = value => (
when(equals('workflow', __), always('endpoints'))(value),
when(equals('integration', __), always('connections'))(value)
)
const parseTitle = title => {
if (title === 'workflow') return 'endpoints';
if (title === 'integration') return 'connections';
return title;
}
parseTitleRamda('integration') // connections
parseTitle('integration') // connections
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment