How to use the is function from ramda

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

23
24
25
26
27
28
29
30
31
32
33
34
}


const isVendorLoggerValid = vendor => {
  if (!R.is(Object, vendor)) return false
  const levels = ['debug', 'error', 'warn', 'info']
  const validationResult = levels.map(level => R.is(Function, vendor[level]))
  return !R.contains(false, validationResult)
}


const isIronMaskVendor = vendor => {
fork icon4
star icon39
watch icon96

+ 283 other calls in file

0
1
2
3
4
5
6
7
8
9
10
11
'use strict';


const R  = require('ramda'),
      __ = require('./_private.js');


const isString                = R.is(String),
      isStringOfLength        = __.ofLength(String, 'identical'),
      isStringOfLengthAtLeast = __.ofLength(String, 'gte'),
      isStringOfLengthAtMost  = __.ofLength(String, 'lte'),
      isStringLongerThan      = __.ofLength(String, 'gt'),
fork icon2
star icon11
watch icon0

5
6
7
8
9
10
11
12
13
14
15
16
const {Just, Nothing} = Maybe
const R = require('ramda')
const {has, pathSatisfies, lt, tap, allPass} = R


const positive = lt(0)
const isObject = R.is(Object)


const isValidSuite = allPass([
  isObject,
  has('suites'),
fork icon1
star icon8
watch icon0

2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
            if (i === 'true')
                return true;
            if (i === 'false')
                return false;
            var cbaN = cbaNumber(i); // cbaNumber(strip_quotes(i));
            return r.is(String, cbaN) ? strip_quotes(i) : cbaN;
        }
        return cleanStrings(i);
    });
}
fork icon0
star icon5
watch icon0

+ 54 other calls in file

2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
 *      R.is(Number, 1); //=> true
 *      R.is(Object, 1); //=> false
 *      R.is(String, 's'); //=> true
 *      R.is(String, new String('')); //=> true
 *      R.is(Object, new String('')); //=> true
 *      R.is(Object, 's'); //=> false
 *      R.is(Number, {}); //=> false
 */
var is = _curry2(function is(Ctor, val) {
    return val != null && val.constructor === Ctor || val instanceof Ctor;
fork icon0
star icon0
watch icon0

+ 151 other calls in file

2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
* @param {*} val The value to test
* @return {Boolean}
* @example
*
*      R.is(Object, {}); //=> true
*      R.is(Number, 1); //=> true
*      R.is(Object, 1); //=> false
*      R.is(String, 's'); //=> true
*      R.is(String, new String('')); //=> true
*      R.is(Object, new String('')); //=> true
fork icon0
star icon0
watch icon2

+ 143 other calls in file

30
31
32
33
34
35
36
37
38
39
name: {
  reason: 'The name of the file is invalid. It must be lowercased, alphanumeric and each component must be more than 2 characters long',
  fn: or([
    R.equals('@'),
    and([
      R.is(String),
      R.compose(
        R.all(or([
          and([
            testRegex(/^_github(-pages)?-challenge-[a-z0-9-_]+$/i), // Exception for github verification records
fork icon0
star icon0
watch icon0

+ 7 other calls in file

57
58
59
60
61
62
63
64
65

const maskCheckPositiveFunc = userMask => gt(userMask & mask, 0);
const maskCheckNegativeFunc = userMask => equals(userMask & mask, 0);

const mandatoryMasksResult = ifElse(
    is(Object),
    userMasks => all(maskCheckPositiveFunc, userMasks),
    maskCheckPositiveFunc
)(mandatoryMasks);
fork icon0
star icon0
watch icon3

+ 5 other calls in file

Other functions in ramda

Sorted by popularity

function icon

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