How to use the range function from ramda
Find comprehensive JavaScript ramda.range code examples handpicked from public code repositorys.
GitHub: calmm-js/partial.lenses
24 25 26 27 28 29 30 31 32 33
const xs10 = Array(10).fill(1) const xs100 = Array(100).fill(1) const xs1000 = Array(1000).fill(1) const xs10000 = Array(10000).fill(1) const xs100000 = Array(100000).fill(1) const ids = R.range(0, 10000).map(i => ({id: i, value: i})) const L_find_id_5000 = L.find(o => o.id === 5000, {hint: 5000}) const xs10o = Object.assign({}, xs10)
41
901
29
+ 3 other calls in file
GitHub: 0xjjpa/github-patterns
300 301 302 303 304 305 306 307 308 309
projectsByLanguages = languages(projects.filter(isFrom2016)); languageStream = Object.keys(projectsByLanguages).map(function (language) { var projectsWithLanguage = projectsByLanguages[language]; return { name: language, total: projectsWithLanguage.length, values: R.range(1, 13).map(function (i) { return { x: i, y: projectsWithLanguage.filter(function (project) { return ~ ~moment(project.starred_at).format('M') === i; }).length }; })
6
57
4
310 311 312 313 314 315 316 317 318 319
if (R.isEmpty(groupedByNights)) { return EMPTY_ARRAY; } var nights = R.range(durationByNights.get('from'), R.inc(durationByNights.get('to'))); return R.map(function (night) { return { night: night, offerID: R.prop(night, groupedByNights) ? R.call(R.pipe(R.prop(night), (0, _helpers.sortOffersByMinPrice)(query.get(_fn.QUERY_PARAMS.CURRENCY)), R.head, R.prop('id')), groupedByNights) : undefined
0
3
0
+ 41 other calls in file
GitHub: corporatepiyush/es6
32 33 34 35 36 37 38 39 40 41 42 43 44 45
fn(50) //=> 'nothing special happens at 50°C' fn(100) //=> 'water boils at 100°C' // Gimme all numbers between 1 and 100, both inclusive const range1To100 = _.range(1, 101) console.log('range1To100=', range1To100) // squares of 1 to 100
1
2
0
GitHub: benji6/awe
17 18 19 20 21 22 23 24 25 26
const newVirtualRoot = h(`div.${pluginName}`, [ h("h2", pluginName), createMenuVirtualRoot(), h("div.center", [ h("table.pattern", R.concat([h("tr", R.map((element) => h("td", element && String(element)), R.range(0, R.length(data) + 2)))], R.mapIndexed((row, rowIndex) => h("tr", R.concat([h("div", h("td", rowsToNotes[rowIndex]))], R.mapIndexed((td, columnIndex) => h("td", h(`div.${model.getClassNameFromCode(td)}`, { onclick: () => controller.patternClick(rowIndex, columnIndex)
0
2
3
GitHub: alvaro-cuesta/aoc-js
25 26 27 28 29 30 31 32 33 34
return [array] } return R.pipe( R.length, R.range(0), R.chain((i) => R.pipe( R.remove, permutations,
0
1
0
+ 4 other calls in file
GitHub: dehmer/levelgist
39 40 41 42 43 44 45 46 47
const length = buffer.int32BE() * 2 const shapeType = buffer.int32LE() if (shapeType === ShapeType.NULL) next(factory({ recordNumber, shapeType })) else { const [xmin, ymin, xmax, ymax] = R.range(0, 4).map(_ => buffer.doubleLE()) const box = { xmin, ymin, xmax, ymax } const numPoints = buffer.int32LE() const points = R.range(0, numPoints).map(_ => [buffer.doubleLE(), buffer.doubleLE()])
0
0
1
+ 19 other calls in file
GitHub: VesaLahd/aoc2022
73 74 75 76 77 78 79 80 81 82 83 84
}) const runRound = R.curry((gcf, monkeys) => R.reduce( runMonkey(gcf), monkeys, R.range(0,R.length(monkeys)) )) const monkeys1 = R.compose( R.map(parseMonkey(true)),
0
0
0
+ 3 other calls in file
3840 3841 3842 3843 3844 3845 3846 3847 3848 3849
* @param {Number} to One more than the last number in the list. * @return {Array} The list of numbers in tthe set `[a, b)`. * @example * * R.range(1, 5); //=> [1, 2, 3, 4] * R.range(50, 53); //=> [50, 51, 52] */ var range = _curry2(function range(from, to) { if (!(_isNumber(from) && _isNumber(to))) { throw new TypeError('Both arguments to range must be numbers');
0
0
0
+ 35 other calls in file
GitHub: octachrome/t2
133 134 135 136 137 138 139 140 141 142 143 144 145 146
// console.log(mapM(turnS, [TurnIn.Coin, TurnIn.Push, TurnIn.Push, TurnIn.Coin, TurnIn.Push]).runWith(TurnState.Locked)); const randomInputS = randomS(0, 1).map(b => b ? TurnIn.Coin : TurnIn.Push); // console.log(mapM(_ => randomInputS, R.range(0, 4)).runWith(mkStdGen(51))); // randomTurnS :: State (StdGen, TurnstileState) TurnstileOutput randomTurnS = State.get().chain(s0 => { const [sg0, ts0] = s0.toArray();
0
0
0
+ 24 other calls in file
GitHub: xasdx/sandbox-ramda
40 41 42 43 44 45 46 47 48 49
expect(i(4, 5)).to.equal(9) }, "filtersFilterables": () => { let range = R.range(1, 10) let obj = { a: 2, b: 3 } let isEven = n => n % 2 === 0 let filterEvenNumbers = R.filter(isEven)
0
0
0
+ 3 other calls in file
14 15 16 17 18 19 20 21 22 23 24 25 26
console.log( `Joltage factor for longest path: ${countJoltageDiffs(sortedAdapters)}` ) const indexRange = R.range(0, sortedAdapters.length) const branchesForIndex = (index) => R.takeWhile( (nextIndex) => sortedAdapters[nextIndex] - sortedAdapters[index] <= 3,
0
0
0
GitHub: jcla1/AdventOfCode
53 54 55 56 57 58 59 60 61 62 63 64
const height = R.length(board); if (height === 0) return []; const width = R.length(board[0]); return R.chain((i) => R.map(R.pair(i), R.range(0, width)), R.range(0, height)); }; // findIndicies :: (a -> Bool) -> [[a]] -> [(Int, Int)] const findIndicies = R.curry((f, board) =>
0
0
0
GitHub: dehmer/lovelace
153 154 155 156 157 158 159 160 161 162 163
const icons = Object.values(options).reduce((acc, options) => { const { metadata, colors, STD2525 } = options const affiliation = metadata.affiliation.toUpperCase() const iconParts = {} R.range(0, 8).forEach(i => ms._iconParts[i](iconParts, metadata, colors, STD2525)) const sanitized = Object.entries(iconParts).reduce((acc, [key, instructions]) => { acc[key] = sanitize(instructions) return acc }, {})
0
0
0
28 29 30 31 32 33 34 35 36 37
}, }, resolvers: (_) => ({ Query: { fetchFeed: (_, { limit }) => { return R.range(0, limit).map((_) => ({})); }, }, }), });
0
0
0
GitHub: jcla1/AdventOfCode
53 54 55 56 57 58 59 60 61 62
console.log(noFlashes); const firstAllFlash = R.reduce((board, i) => { if (R.all(R.equals(0), R.flatten(board))) return R.reduced(i); return doStep(board)[1]; }, board, R.range(0, 100000)); console.log(firstAllFlash);
0
0
0
ramda.clone is the most popular function in ramda (30311 examples)