+ const isValidScore = score =>
+ score >= 70
+
+ const isValidUser = user =>
+ user && user.length > 3
data.reduce((acc, rec) => {
const { score, user } = rec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import curry from 'crocks/helpers/curry' | |
| import or from 'crocks/logic/or' | |
| import pathSatisfies from 'crocks/predicates/pathSatisfies' | |
| import propSatisfies from 'crocks/predicates/propSatisfies' | |
| const list = [ | |
| 'nice', 'bad', 'super bad' | |
| ] | |
| const data = [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const recs = [ | |
| { learner: 'Joan', score: 84 }, | |
| null, | |
| { learner: null, score: 97 }, | |
| { learner: 'Thomas', score: 72 }, | |
| 22, | |
| { learner: 'Bob', score: 92 } | |
| { learner: 'Joey', score: 62 }, | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Maybe from 'crocks/Maybe' | |
| import Star from 'crocks/Star' | |
| import prop from 'crocks/Maybe/prop' | |
| import propOr from 'crocks/helpers/propOr' | |
| import resultToMaybe from 'crocks/Maybe/resultToMaybe' | |
| import tryCatch from 'crocks/Result/tryCatch' | |
| const MaybeStar = | |
| Star(Maybe) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Async, identity } from 'crocks' | |
| // A Promise is not a Functor, since it is not | |
| // a functor it cannot be a Monad | |
| Promise | |
| .resolve(Promise.resolve(3)) | |
| .then(console.log) | |
| //=> 3 | |
| // should return a Promise that will return 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { | |
| bimap, compose, composeK, fanout, isNumber, | |
| liftA2, map, merge, prop, safe | |
| } = require('crocks') | |
| const { | |
| add, multiply | |
| } = require('ramda') | |
| ///////////////////////////////////////////////////////////////// |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Hello. how are you? | |
| Hello. how are you? | |
| Hello. how are you? | |
| Hello. how are you? | |
| Hello. how are you? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Async = require('crocks/Async') | |
| const assign = require('crocks/helpers/assign') | |
| const compose = require('crocks/helpers/compose') | |
| const isNil = require('crocks/predicates/isNil') | |
| const maybeToAsync = require('crocks/Async/maybeToAsync') | |
| const not = require('crocks/logic/not') | |
| const objOf = require('crocks/helpers/objOf') | |
| const prop = require('crocks/Maybe/prop') | |
| const safeAfter = require('crocks/Maybe/safeAfter') | |
| const tap = require('crocks/helpers/tap') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const State = require('crocks/State') | |
| const { get } = State | |
| const assign = require('crocks/helpers/assign') | |
| const concat = require('crocks/pointfree/concat') | |
| const constant = require('crocks/combinators/constant') | |
| const flip = require('crocks/combinators/flip') | |
| const isString = require('crocks/predicates/isString') | |
| const liftA2 = require('crocks/helpers/liftA2') | |
| const mapReduce = require('crocks/helpers/mapReduce') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { validateUser } = require('../data/users') | |
| const { | |
| compose, curry, objOf | |
| } = require('crocks') | |
| module.exports = ({ config, express, jwt, knex }) => { | |
| const { jwtSecret } = config | |
| const router = express.Router() |
NewerOlder