Open Undistraction opened 6 years ago
http://ramdajs.com/docs/#pick, http://ramdajs.com/docs/#pickAll or http://ramdajs.com/docs/#pickBy doesn't satisfy your usecase ?
http://ramdajs.com/docs/#pick, http://ramdajs.com/docs/#pickAll or http://ramdajs.com/docs/#pickBy doesn't satisfy your usecase ?
No. They all have a very different intent - they are focused on copying key value pairs from an object to a new object - Object -> ... -> Object
. The function I'm talking about uses an object to filter a list of keys [String] -> ... -> [String]
Ahh I get it. You want intersection of the list of the possible keys and the real ones.
intersectKeysWith = curry(fn, keys, obj) => ...); IntersectKeys = intersectKeysWith(has);
Does it make sence ?
Makes sense: REPL
Sounds to me like R.difference(oKeys, R.keys(o)
, or, as a function, R.useWith(R.difference, [R.identity, R.keys])
Is your feature request related to a problem? Please describe.
Intersect object keys with the list of provided key names.
Describe the solution you'd like
Describe alternatives you've considered
--
Additional context
Original issue description: filterKeys :: [String] => Object => [String]
Ramda currently offers props, but there is no equivalent for keys, so how about
keysOf
:REPL
Note: Ramda's props returns
undefined
values for any values that aren't matched, but I don't think that makes sense here as these are keys, not the values.Usecase: I need to make sure an object doesn't include more than one of a set of exclusive keys.