How to use the contains function from ramda

Find comprehensive JavaScript ramda.contains code examples handpicked from public code repositorys.

146
147
148
149
150
151
152
153
154
155
156
 * 值数组是否包含 某特定值

 * arr ['']
 */
export function isArrayHave(x, arr) {
  return R.contains(x, arr);
}


/**
 * 对象数组是否包含 某特定对象属性值
fork icon1
star icon0
watch icon0

228
229
230
231
232
233
234
235
236
    return R.map(
        R.pipe(
            R.prop('transactions'),
            R.map(R.pipe(
                R.path(['data', 'inputs']),
                R.contains({ transaction: txInput.transaction, index: txInput.index })
            ))
        ), referenceBlockchain);
}, transaction.data.inputs)));
fork icon0
star icon1
watch icon0

8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
 * @param {Array} list The array to consider.
 * @return {Boolean} `true` if the item is in the list, `false` otherwise.
 * @see R.any
 * @example
 *
 *      R.contains(3, [1, 2, 3]); //=> true
 *      R.contains(4, [1, 2, 3]); //=> false
 *      R.contains([42], [[42]]); //=> true
 */
var contains = _curry2(_contains);
fork icon0
star icon0
watch icon0

+ 53 other calls in file

2066
2067
2068
2069
2070
2071
2072
2073
2074
* @deprecated since v0.26.0
* @example
*
*      R.contains(3, [1, 2, 3]); //=> true
*      R.contains(4, [1, 2, 3]); //=> false
*      R.contains({ name: 'Fred' }, [{ name: 'Fred' }]); //=> true
*      R.contains([42], [[42]]); //=> true
*      R.contains('ba', 'banana'); //=>true
*/
fork icon0
star icon0
watch icon2

+ 19 other calls in file

118
119
120
121
122
123
124
125
126
127
128
129
130
]);


const Executor = {};


Executor.assertAvailable = (action, game) => 
  R.contains(action, Action.listAvailable(game)) ||
  raiseError(`Action ${action.action} is not available in state ${State.getId(game)}`);


Executor.claimAction = action => R.set(State.lens, R.mergeLeft(action, {id: State.ACTION_RESPONSE}));

fork icon0
star icon0
watch icon0

+ 3 other calls in file

84
85
86
87
88
89
90
91
92
93
const { currentTags } = action.payload
let allEvents = state.events

const getTagForEvent = R.path(["SecondaryTag", "Title"])
const filterWithTags = tags => event =>
  R.contains(getTagForEvent(event), tags)
const forData = tags => R.filter(filterWithTags(tags))
const forDay = tags => R.map(forData(tags))
const forMonth = tags => R.map(forDay(tags))
const forYear = tags => R.map(forMonth(tags))
fork icon0
star icon0
watch icon0

Other functions in ramda

Sorted by popularity

function icon

ramda.clone is the most popular function in ramda (30311 examples)