How to use the type function from ramda

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

24
25
26
27
28
29
30
31
32
33
34
35
    }
  }
})()


const normalizeLoaded = x =>
  type(x) === 'String'
    ? load(`@piece/updated-cra-${x}`) || load(`piece-${x}`) || load(x) || load(`@piece/${x}`) || loadFromRoot(x)
    : x


const loadCreatorAndApplyArgs = ([creator, ...args]) => normalizeLoaded(creator)(...args)
fork icon2
star icon5
watch icon0

11
12
13
14
15
16
17
18
19
20
const transform = compose(...normalizedArray)

const resolved = require.resolve(path)
const config = require(resolved)
require.cache[resolved].exports =
  type(config) === 'Function'
    ? (...args) => {
        const original = config(...args)

        return transform(original)
fork icon2
star icon5
watch icon0

+ 2 other calls in file

165
166
167
168
169
170
171
172
173
174
175
  const arr = new Map([['0', '阅读'], ['1', '签收'], ['2', '通知']]);
  const value = arr.get(key) || '';
  return value;
}
export function isArray(val) {
  return R.type(val) == 'Array';
}


/* eslint-disable  no-new-func */
export function evil(str) {
fork icon1
star icon0
watch icon0

4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
* @sig (* -> {*}) -> String
* @param {*} val The value to test
* @return {String}
* @example
*
*      R.type({}); //=> "Object"
*      R.type(1); //=> "Number"
*      R.type(false); //=> "Boolean"
*      R.type('s'); //=> "String"
*      R.type(null); //=> "Null"
fork icon0
star icon0
watch icon0

+ 125 other calls in file

14047
14048
14049
14050
14051
14052
14053
14054
14055
*      R.type(false); //=> "Boolean"
*      R.type('s'); //=> "String"
*      R.type(null); //=> "Null"
*      R.type([]); //=> "Array"
*      R.type(/[A-z]/); //=> "RegExp"
*      R.type(() => {}); //=> "Function"
*      R.type(undefined); //=> "Undefined"
*/

fork icon0
star icon0
watch icon2

+ 35 other calls in file

Other functions in ramda

Sorted by popularity

function icon

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