1 | import { propEq, complement } from 'ramda';
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Returns true if the specified object property is not equal,
|
---|
5 | * in R.equals terms, to the given value; false otherwise.
|
---|
6 | *
|
---|
7 | * @func propNotEq
|
---|
8 | * @memberOf RA
|
---|
9 | * @since {@link https://char0n.github.io/ramda-adjunct/2.3.0|v2.3.0}
|
---|
10 | * @category Relation
|
---|
11 | * @sig a -> String -> Object -> Boolean
|
---|
12 | * @param {a} val The value to compare to
|
---|
13 | * @param {String} name The property to pick
|
---|
14 | * @param {Object} object The object, that presumably contains value under the property
|
---|
15 | * @return {boolean} Comparison result
|
---|
16 | * @see {@link http://ramdajs.com/docs/#propEq|R.propEq}
|
---|
17 | * @example
|
---|
18 | *
|
---|
19 | * const abby = { name: 'Abby', age: 7, hair: 'blond' };
|
---|
20 | * const fred = { name: 'Fred', age: 12, hair: 'brown' };
|
---|
21 | * const rusty = { name: 'Rusty', age: 10, hair: 'brown' };
|
---|
22 | * const alois = { name: 'Alois', age: 15, disposition: 'surly' };
|
---|
23 | * const kids = [abby, fred, rusty, alois];
|
---|
24 | * const hasNotBrownHair = RA.propNotEq('brown', 'hair');
|
---|
25 | *
|
---|
26 | * R.filter(hasNotBrownHair, kids); //=> [abby, alois]
|
---|
27 | */
|
---|
28 | const propNotEq = complement(propEq);
|
---|
29 |
|
---|
30 | export default propNotEq;
|
---|