[d24f17c] | 1 | import { complement } from 'ramda';
|
---|
| 2 |
|
---|
| 3 | import lensSatisfies from './lensSatisfies';
|
---|
| 4 |
|
---|
| 5 | /**
|
---|
| 6 | * Returns `true` if data structure focused by the given lens doesn't satisfy the predicate.
|
---|
| 7 | * Note that the predicate is expected to return boolean value.
|
---|
| 8 | *
|
---|
| 9 | * @func lensNotSatisfy
|
---|
| 10 | * @memberOf RA
|
---|
| 11 | * @since {@link https://char0n.github.io/ramda-adjunct/1.13.0|1.13.0}
|
---|
| 12 | * @category Relation
|
---|
| 13 | * @typedef Lens s a = Functor f => (a -> f a) -> s -> f s
|
---|
| 14 | * @sig Boolean b => (a -> b) -> Lens s a -> s -> b
|
---|
| 15 | * @see {@link RA.lensSatisfies|lensSatisfies}
|
---|
| 16 | * @param {Function} predicate The predicate function
|
---|
| 17 | * @param {Function} lens Van Laarhoven lens
|
---|
| 18 | * @param {*} data The data structure
|
---|
| 19 | * @return {boolean} `false` if the focused data structure satisfies the predicate, `true` otherwise
|
---|
| 20 | *
|
---|
| 21 | * @example
|
---|
| 22 | *
|
---|
| 23 | * RA.lensNotSatisfy(RA.isTrue, R.lensIndex(0), [false, true, 1]); // => true
|
---|
| 24 | * RA.lensNotSatisfy(RA.isTrue, R.lensIndex(1), [false, true, 1]); // => false
|
---|
| 25 | * RA.lensNotSatisfy(RA.isTrue, R.lensIndex(2), [false, true, 1]); // => true
|
---|
| 26 | * RA.lensNotSatisfy(R.identity, R.lensProp('x'), { x: 1 }); // => true
|
---|
| 27 | */
|
---|
| 28 | const lensNotSatisfy = complement(lensSatisfies);
|
---|
| 29 |
|
---|
| 30 | export default lensNotSatisfy;
|
---|