How to use the init function from ramda

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

10
11
12
13
14
15
16
17
18
19
  return R.equals('String', R.type(cur));
}

function changeEndPath(folderName, path) {
  const pathAsArray = R.split('/', path);
  const initOfPath = R.init(pathAsArray);
  const folderAddedToPath = R.append(folderName, initOfPath);

  return R.join('/', folderAddedToPath);
}
fork icon1
star icon0
watch icon2

5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
* @param {*} list
* @return {*}
* @see R.last, R.head, R.tail
* @example
*
*      R.init([1, 2, 3]);  //=> [1, 2]
*      R.init([1, 2]);     //=> [1]
*      R.init([1]);        //=> []
*      R.init([]);         //=> []
*
fork icon0
star icon0
watch icon0

+ 143 other calls in file

22
23
24
25
26
27
28
29
30
31
32
33
34
const lazyTask = fn => data => () => fn(data);


const batchLazyTasks = count => tasks => tasks.reduce((batches, task) => {
  if (batches.length === 0) return [[task]];


  const full = R.init(batches);
  const last = R.last(batches);


  if (last.length >= count) return [...batches, [task]];
  return [...full, [...last, task]];
fork icon0
star icon0
watch icon0

+ 3 other calls in file

64
65
66
67
68
69
70
71
72
73
74
  
  const cleanedChrom = genes(x)
        .reduceRight(buildChrom, () => [])(GeneType.number)
  const gs = genes(cleanedChrom)
  return (!numbers.includes(geneToChar(R.last(gs))))
    ? R.init(gs).flat()
    : cleanedChrom
}


// Chromosome -> String
fork icon0
star icon0
watch icon0

+ 2 other calls in file

Other functions in ramda

Sorted by popularity

function icon

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