How to use the applySpec function from ramda

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

36
37
38
39
40
41
42
43
44
45
46
47
48


const titleFilter = pipe(R.propEq(R.__, 'title'), R.filter);


const valueProp = R.chain(prop('value'));


const simplifyData = R.applySpec({
	aka: pipe(
		prop('tags'),
		titleFilter('aka'),
		valueProp,
fork icon24
star icon163
watch icon0

28
29
30
31
32
33
34
35
36
37
38
39
function Library(obj, args) {
  this.$middleware = [];
  this[objSymbol] = Object.assign({}, obj);
  this[argsSymbol] = args;


  const _applySpec = applySpec(obj);


  if (typeof args[0] === 'object' && args[0] != null && !args[0].hasOwnProperty('lib')) {
    args[0] = Object.assign({}, args[0], { lib: this });
  }
fork icon2
star icon10
watch icon0

464
465
466
467
468
469
470
471
472
473
 */
const printHtmlIssuesToConsole = (htmlIssues) => {
  R.pipe(
    // restructure the output of the HTMLHint
    R.map(
      R.applySpec({
        url: R.prop("url"),
        errors: R.pipe(
          R.identity,
          R.pipe(
fork icon2
star icon5
watch icon0

398
399
400
401
402
403
404
405
406
407
var getCenterByHotelsMarkers = function getCenterByHotelsMarkers() {
  return (0, _reselect.createSelector)(getHotelsMarkers(), function (markers) {
    return !R.isEmpty(markers) ? R.call(R.pipe(R.map(R.applySpec({
      latitude: R.path(['position', 'lat']),
      longitude: R.path(['position', 'lng'])
    })), _geolib.getCenter, R.applySpec({
      lat: R.prop('latitude'),
      lng: R.prop('longitude')
    })), markers) : undefined;
  });
fork icon0
star icon3
watch icon4

+ 41 other calls in file

7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
* as `spec', with each property set to the value returned by calling its
* associated function with the supplied arguments.
* @see R.converge, R.juxt
* @example
*
*      var getMetrics = R.applySpec({
*                                      sum: R.add,
*                                      nested: { mul: R.multiply }
*                                   });
*      getMetrics(2, 4); // => { sum: 6, nested: { mul: 8 } }
fork icon0
star icon0
watch icon0

+ 35 other calls in file

934
935
936
937
938
939
940
941
942
943
* as `spec', with each property set to the value returned by calling its
* associated function with the supplied arguments.
* @see R.converge, R.juxt
* @example
*
*      const getMetrics = R.applySpec({
*        sum: R.add,
*        nested: { mul: R.multiply }
*      });
*      getMetrics(2, 4); // => { sum: 6, nested: { mul: 8 } }
fork icon0
star icon0
watch icon2

+ 11 other calls in file

Other functions in ramda

Sorted by popularity

function icon

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