Ramda: Equivalent to lodash's uniqueId()

Created on 27 Aug 2015  路  3Comments  路  Source: ramda/ramda

I'm trying to migrate from Ramda to lodash, and one thing we use in tests quite often is uniqueId(), which is useful for making test users and the like (ie fields that should be unique). I'm wondering if it's in the Ramda philosophy/whatever to have a function like this? Also, if there's something that already exists for this, please let me know, cause I can't find anything.

Most helpful comment

Yes, this one is definitely outside Ramda's philosophy, in which a function called with the same parameters (even if that's no parameters) should get the same results every time.

All 3 comments

Will probably not go into ramda since this seems to be a non pure function. But there seems to be plenty of alternatives available for this specific task. https://www.npmjs.com/search?q=unique+id

lodash.uniqueid, require('lodash/utility/uniqueId'), or even lodash-fp will do if you're comfortable with lodash already.

Yes, this one is definitely outside Ramda's philosophy, in which a function called with the same parameters (even if that's no parameters) should get the same results every time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cjohansen picture cjohansen  路  4Comments

woss picture woss  路  3Comments

makarkotlov picture makarkotlov  路  3Comments

davidchambers picture davidchambers  路  4Comments

sugoidesune picture sugoidesune  路  3Comments