Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
byteshiva committed Mar 24, 2019
1 parent 86fb07e commit 48e2777
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
20 changes: 20 additions & 0 deletions functionalprogramming/day184/funcday184/index.js
@@ -0,0 +1,20 @@
const R = require('ramda');

const groupNames = (acc, {name}) => acc.concat(name)
const toGrade = ({score}) =>
score < 65 ? 'F' :
score < 70 ? 'D' :
score < 80 ? 'C' :
score < 90 ? 'B' : 'A'

var students = [
{name: 'Abby', score: 83},
{name: 'Bart', score: 62},
{name: 'Curt', score: 88},
{name: 'Dora', score: 92},
]

const rreduceby1 = reduceBy(groupNames, [], toGrade, students)
//=> {"A": ["Dora"], "B": ["Abby", "Curt"], "F": ["Bart"]}

console.log(rreduceby1);
12 changes: 12 additions & 0 deletions functionalprogramming/day184/funcday184/package.json
@@ -0,0 +1,12 @@
{
"name": "funcday184",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}

0 comments on commit 48e2777

Please sign in to comment.