Created
December 2, 2016 16:44
-
-
Save keyserfaty/6bfffed7a74855342f0e7f15576e91a2 to your computer and use it in GitHub Desktop.
Some fn in Javascript vs Ramda
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
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