How to use the unless function from ramda

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

34
35
36
37
38
39
40
41
42
43
  get hasVal() {
    const has = this.has
    return P(rProp.val, has)
  }
}
const errorCheck = unless(util.isof.Empty, Err.Throw.Args)
const callNotFunc = (token, userArg) => eq.type.context(token)&&!util.isof.Func(userArg)
function fillUserData(userData, dataPack) {
  const indexMap = new IndexMap(dataPack.context) //TODO create dataPack.context as empty array
  const isArgOrCont = eq.type.arg.context
fork icon0
star icon10
watch icon4

+ 13 other calls in file

95
96
97
98
99
100
101
102
103
104
 *    to be a parsed object)
 */
function extractErrors(error) {
  return R.pipe(
    R.pathOr([], ["response", "data", "errors"]),
    R.unless(
      Array.isArray,
      R.pipe(
        R.prop("error"),
        R.unless(Array.isArray, R.of)
fork icon1
star icon0
watch icon0

+ 2 other calls in file

65
66
67
68
69
70
71
72
73
74
  (p) => Promise.all(p),
  R.andThen(
    R.pipe(
      R.map(logReport),
      R.reject(R.equals(false)),
      R.unless(R.isEmpty, () => process.exit(1)),
    ),
  ),
);

fork icon0
star icon2
watch icon0

4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
 * @return {*} Either `x` or the result of applying `x` to `whenFalseFn`.
 * @see R.ifElse, R.when
 * @example
 *
 *      // coerceArray :: (a|[a]) -> [a]
 *      var coerceArray = R.unless(R.isArrayLike, R.of);
 *      coerceArray([1, 2, 3]); //=> [1, 2, 3]
 *      coerceArray(1);         //=> [1]
 */
var unless = _curry3(function unless(pred, whenFalseFn, x) {
fork icon0
star icon0
watch icon0

+ 17 other calls in file

14484
14485
14486
14487
14488
14489
14490
14491
14492
*                               pass to `whenFalseFn` if necessary.
* @return {*} Either `x` or the result of applying `x` to `whenFalseFn`.
* @see R.ifElse, R.when, R.cond
* @example
*
*      let safeInc = R.unless(R.isNil, R.inc);
*      safeInc(null); //=> null
*      safeInc(1); //=> 2
*/
fork icon0
star icon0
watch icon2

+ 3 other calls in file

2
3
4
5
6
7
8
9
10
11
12
13
14
Object.defineProperty(exports, '__esModule', { value: true });


var ramda = require('ramda');
var fluture = require('fluture');


const toFuture = ramda.unless(fluture.isFuture, fluture.resolve);


const getter = (l) => (data) => (ramda.compose(
    ramda.chain((value) => ramda.isNil(value) ? fluture.reject(data) : fluture.resolve(value)),
    ramda.chain((value) => toFuture(value)),
fork icon0
star icon0
watch icon0

13
14
15
16
17
18
19
20
21
22
    inotifyInstance = new Inotify();
    return inotifyInstance;
}

function getDefaultInotifyInstance() {
    inotifyInstance = unless(complement(isNil), createDefaultInotifyInstance)(inotifyInstance);
    return inotifyInstance
}

function getMaskChainVariantsMaxMasks(maskChains) {
fork icon0
star icon0
watch icon3

Other functions in ramda

Sorted by popularity

function icon

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