Skip to content

Commit

Permalink
Add Either, right and Left, min, reduce and sort, and some doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Sitefig committed Jun 15, 2019
1 parent ec5a146 commit 3cbd611
Show file tree
Hide file tree
Showing 111 changed files with 10,698 additions and 1,704 deletions.
4,127 changes: 3,151 additions & 976 deletions docs.json

Large diffs are not rendered by default.

193 changes: 193 additions & 0 deletions docs/Either.Left.html

Large diffs are not rendered by default.

193 changes: 193 additions & 0 deletions docs/Either.Right.html

Large diffs are not rendered by default.

756 changes: 756 additions & 0 deletions docs/Either.html

Large diffs are not rendered by default.

193 changes: 193 additions & 0 deletions docs/Either_Left.html

Large diffs are not rendered by default.

193 changes: 193 additions & 0 deletions docs/Either_Right.html

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions docs/Just.html

Large diffs are not rendered by default.

1,563 changes: 1,563 additions & 0 deletions docs/Left.html

Large diffs are not rendered by default.

260 changes: 183 additions & 77 deletions docs/Maybe.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/Maybe_Just.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/Maybe_Nothing.html

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions docs/Nothing.html

Large diffs are not rendered by default.

1,561 changes: 1,561 additions & 0 deletions docs/Right.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/addIndex.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/adjust.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/adjustWith.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/all.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/allPass.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/always.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/and.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/any.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/anyPass.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/ap.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/aperture.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/append.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/apply.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/array_fold.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/array_map.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/array_to.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/array_union.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/binary.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/bind.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/boolean_F.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/boolean_T.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/call.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/complement.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/compose.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/concat.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/cond.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/curry.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/date_diffDate.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/date_formatDateTime.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/date_getWeek.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/date_toDay.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/date_toHour.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/date_toMinutes.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/date_toSeconds.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/defaultTo.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/empty.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/equals.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/exists.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/filter.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/findIndex.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/first.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/flatMap.js.html

Large diffs are not rendered by default.

27 changes: 5 additions & 22 deletions docs/fold.js.html

Large diffs are not rendered by default.

738 changes: 590 additions & 148 deletions docs/global.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/identical.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/identity.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/is.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/isEmpty.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/keys.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/last.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/lift.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/map.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/max.js.html

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions docs/min.js.html

Large diffs are not rendered by default.

161 changes: 161 additions & 0 deletions docs/monads_Either.js.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/monads_Just.js.html

Large diffs are not rendered by default.

170 changes: 170 additions & 0 deletions docs/monads_Left.js.html

Large diffs are not rendered by default.

43 changes: 28 additions & 15 deletions docs/monads_Maybe.js.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/monads_Nothing.js.html

Large diffs are not rendered by default.

171 changes: 171 additions & 0 deletions docs/monads_Right.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/not.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/number_add.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/number_divide.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/number_isNan.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/object_path.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/object_pick.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/object_prop.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/object_values.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/or.js.html

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions docs/reduce.js.html

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions docs/sort.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/truthy.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/type.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/zip.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/zipObj.js.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/zipWith.js.html

Large diffs are not rendered by default.

690 changes: 631 additions & 59 deletions lib/fun.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/fun.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/fun.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/fun.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fun.js",
"sideEffects": false,
"version": "1.0.4",
"version": "1.0.5",
"description": "Functional tools for javascript development",
"main": "lib/fun.js",
"module": "src/index.js",
Expand Down
23 changes: 3 additions & 20 deletions src/fold.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
* @function fold
* @description Returns a single item by iterating over an array like object and call a function on each item
* @since v1.0.2
* @sig ((a, b, c, a) → a) → a → [b] → a
* @param {Function} cb receives 4 values: the accumulator, the item, the index, and the initial value.
* @param {*} a is the initial value
* @param {*} [b] the array like item to iterate over
* @return {*} a is the accumulated value
* @param {*} init - the the initial value
* @param {Array|Object} a the array like item to iterate over
* @return {*} The accumulated value
**/

import curry from './curry'
import arrayFold from './array/fold'
import objectFold from './object/fold'
Expand All @@ -21,20 +19,5 @@ export default curry(function fold (cb, init, a) {
'Object': objectFold,
'Array': arrayFold
}
// if (a.next) {
// return iterableFold(cb, init, a)
// }
// if (type(Symbol) !== 'undefined' && a[Symbol.iterator]) {
// return iterableFold(cb, init, a[Symbol.iterator]())
// }
return typeMap[type(a)](cb, init, a)
})

// function iterableFold (cb, acc, gen) {
// let step = gen.next()
// while (!step.done) {
// acc = cb(acc, step.value)
// step = gen.next()
// }
// return acc
// }
204 changes: 8 additions & 196 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,199 +1,3 @@
// export { default as __ } from './__';
export { default as aperture } from './aperture'
// export { default as applySpec } from './applySpec'
// export { default as applyTo } from './applyTo'
// export { default as ascend } from './ascend'
// export { default as assoc } from './assoc'
// export { default as assocPath } from './assocPath'
// export { default as clamp } from './clamp'
// export { default as clone } from './clone'
// export { default as comparator } from './comparator'
// export { default as composeK } from './composeK'
// export { default as composeP } from './composeP'
// export { default as composeWith } from './composeWith'
// export { default as construct } from './construct'
// export { default as constructN } from './constructN'
// export { default as contains } from './contains'
// export { default as converge } from './converge'
// export { default as countBy } from './countBy'
// export { default as dec } from './dec'
// export { default as descend } from './descend'
// export { default as difference } from './difference'
// export { default as differenceWith } from './differenceWith'
// export { default as dissoc } from './dissoc'
// export { default as dissocPath } from './dissocPath'
// export { default as drop } from './drop'
// export { default as dropLast } from './dropLast'
// export { default as dropLastWhile } from './dropLastWhile'
// export { default as dropRepeats } from './dropRepeats'
// export { default as dropRepeatsWith } from './dropRepeatsWith'
// export { default as dropWhile } from './dropWhile'
// export { default as either } from './either'
// export { default as endsWith } from './endsWith'
// export { default as eqBy } from './eqBy'
// export { default as eqProps } from './eqProps'
// export { default as evolve } from './evolve'
// export { default as find } from './find'
// export { default as findLast } from './findLast'
// export { default as findLastIndex } from './findLastIndex'
// export { default as flatten } from './flatten'
// export { default as flip } from './flip'
// export { default as forEach } from './forEach'
// export { default as forEachObjIndexed } from './forEachObjIndexed'
// export { default as fromPairs } from './fromPairs'
// export { default as groupBy } from './groupBy'
// export { default as groupWith } from './groupWith'
// export { default as gt } from './gt'
// export { default as gte } from './gte'
// export { default as hasPath } from './hasPath'
// export { default as head } from './head'
// export { default as ifElse } from './ifElse'
// export { default as inc } from './inc'
// export { default as includes } from './includes'
// export { default as indexBy } from './indexBy'
// export { default as indexOf } from './indexOf'
// export { default as init } from './init'
// export { default as innerJoin } from './innerJoin'
// export { default as insert } from './insert'
// export { default as insertAll } from './insertAll'
// export { default as intersection } from './intersection'
// export { default as intersperse } from './intersperse'
// export { default as into } from './into'
// export { default as invert } from './invert'
// export { default as invertObj } from './invertObj'
// export { default as invoker } from './invoker'
// export { default as join } from './join'
// export { default as juxt } from './juxt'
// export { default as lastIndexOf } from './lastIndexOf'
// export { default as length } from './length'
// export { default as lens } from './lens'
// export { default as lensIndex } from './lensIndex'
// export { default as lensPath } from './lensPath'
// export { default as lensProp } from './lensProp'
// export { default as liftN } from './liftN'
// export { default as lt } from './lt'
// export { default as lte } from './lte'
// export { default as mapAccum } from './mapAccum'
// export { default as mapAccumRight } from './mapAccumRight'
// export { default as mapObjIndexed } from './mapObjIndexed'
// export { default as match } from './match'
// export { default as mathMod } from './mathMod'
// export { default as maxBy } from './maxBy'
// export { default as mean } from './mean'
// export { default as median } from './median'
// export { default as memoizeWith } from './memoizeWith'
// export { default as mergeAll } from './mergeAll'
// export { default as mergeDeepLeft } from './mergeDeepLeft'
// export { default as mergeDeepRight } from './mergeDeepRight'
// export { default as mergeDeepWith } from './mergeDeepWith'
// export { default as mergeDeepWithKey } from './mergeDeepWithKey'
// export { default as mergeLeft } from './mergeLeft'
// export { default as mergeRight } from './mergeRight'
// export { default as mergeWith } from './mergeWith'
// export { default as mergeWithKey } from './mergeWithKey'
// export { default as min } from './min'
// export { default as minBy } from './minBy'
// export { default as modulo } from './modulo'
// export { default as move } from './move'
// export { default as nAry } from './nAry'
// export { default as negate } from './negate'
// export { default as none } from './none'
// export { default as nth } from './nth'
// export { default as nthArg } from './nthArg'
// export { default as o } from './o'
// export { default as objOf } from './objOf'
// export { default as of } from './of'
// export { default as once } from './once'
// export { default as otherwise } from './otherwise'
// export { default as over } from './over'
// export { default as pair } from './pair'
// export { default as partial } from './partial'
// export { default as partialRight } from './partialRight'
// export { default as partition } from './partition'
// export { default as pathEq } from './pathEq'
// export { default as pathOr } from './pathOr'
// export { default as pathSatisfies } from './pathSatisfies'
// export { default as pickAll } from './pickAll'
// export { default as pickBy } from './pickBy'
// export { default as pipe } from './pipe'
// export { default as pipeK } from './pipeK'
// export { default as pipeP } from './pipeP'
// export { default as pipeWith } from './pipeWith'
// export { default as pluck } from './pluck'
// export { default as prepend } from './prepend'
// export { default as product } from './product'
// export { default as project } from './project'
// export { default as propEq } from './propEq'
// export { default as propIs } from './propIs'
// export { default as propOr } from './propOr'
// export { default as props } from './props'
// export { default as propSatisfies } from './propSatisfies'
// export { default as range } from './range'
// export { default as reduceBy } from './reduceBy'
// export { default as reduced } from './reduced'
// export { default as reduceRight } from './reduceRight'
// export { default as reduceWhile } from './reduceWhile'
// export { default as reject } from './reject'
// export { default as remove } from './remove'
// export { default as repeat } from './repeat'
// export { default as replace } from './replace'
// export { default as reverse } from './reverse'
// export { default as scan } from './scan'
// export { default as sequence } from './sequence'
// export { default as set } from './set'
// export { default as slice } from './slice'
// export { default as sort } from './sort'
// export { default as sortBy } from './sortBy'
// export { default as sortWith } from './sortWith'
// export { default as split } from './split'
// export { default as splitAt } from './splitAt'
// export { default as splitEvery } from './splitEvery'
// export { default as splitWhen } from './splitWhen'
// export { default as startsWith } from './startsWith'
// export { default as subtract } from './subtract'
// export { default as symmetricDifference } from './symmetricDifference'
// export { default as symmetricDifferenceWith } from './symmetricDifferenceWith'
// export { default as tail } from './tail'
// export { default as take } from './take'
// export { default as takeLast } from './takeLast'
// export { default as takeLastWhile } from './takeLastWhile'
// export { default as takeWhile } from './takeWhile'
// export { default as tap } from './tap'
// export { default as test } from './test'
// export { default as then } from './then'
// export { default as thunkify } from './thunkify'
// export { default as times } from './times'
// export { default as toLower } from './toLower'
// export { default as toPairs } from './toPairs'
// export { default as toPairsIn } from './toPairsIn'
// export { default as toString } from './toString'
// export { default as toUpper } from './toUpper'
// export { default as transduce } from './transduce'
// export { default as transpose } from './transpose'
// export { default as traverse } from './traverse'
// export { default as trim } from './trim'
// export { default as tryCatch } from './tryCatch'
// export { default as unapply } from './unapply'
// export { default as unary } from './unary'
// export { default as uncurryN } from './uncurryN'
// export { default as unfold } from './unfold'
// export { default as unionWith } from './unionWith'
// export { default as uniq } from './uniq'
// export { default as uniqBy } from './uniqBy'
// export { default as uniqWith } from './uniqWith'
// export { default as unless } from './unless'
// export { default as unnest } from './unnest'
// export { default as until } from './until'
// export { default as update } from './update'
// export { default as useWith } from './useWith'
// export { default as valuesIn } from './valuesIn'
// export { default as view } from './view'
// export { default as when } from './when'
// export { default as where } from './where'
// export { default as whereEq } from './whereEq'
// export { default as without } from './without'
// export { default as xprod } from './xprod'
export { default as zipObj } from './zipObj'
export { default as add } from './number/add'
export { default as addIndex } from './addIndex'
export { default as adjust } from './adjust'
Expand All @@ -205,6 +9,7 @@ export { default as and } from './and'
export { default as any } from './any'
export { default as anyPass } from './anyPass'
export { default as ap } from './ap'
export { default as aperture } from './aperture'
export { default as append } from './append'
export { default as apply } from './apply'
export { default as binary } from './binary'
Expand All @@ -219,6 +24,9 @@ export { default as curry } from './curry'
export { default as defaultTo } from './defaultTo'
export { default as diffDate } from './date/diffDate'
export { default as divide } from './number/divide'
export { default as Either } from './monads/Either'
export { default as Left } from './monads/Left'
export { default as Right } from './monads/Right'
export { default as empty } from './empty'
export { default as equals } from './equals'
export { default as exists } from './exists'
Expand Down Expand Up @@ -257,6 +65,7 @@ export { default as map } from './map'
export { default as max } from './max'
export { default as Maybe } from './monads/Maybe'
export { default as merge } from './object/merge'
export { default as min } from './min'
export { default as multiply } from './number/multiply'
export { default as not } from './not'
export { default as Nothing } from './monads/Nothing'
Expand All @@ -265,6 +74,8 @@ export { default as or } from './or'
export { default as path } from './object/path'
export { default as pick } from './object/pick'
export { default as prop } from './object/prop'
export { default as reduce } from './reduce'
export { default as sort } from './sort'
export { default as sum } from './number/sum'
export { default as T } from './boolean/T'
export { default as toDay } from './date/toDay'
Expand All @@ -276,4 +87,5 @@ export { default as type } from './type'
export { default as union } from './array/union'
export { default as values } from './object/values'
export { default as zip } from './zip'
export { default as zipObj } from './zipObj'
export { default as zipWith } from './zipWith'
15 changes: 15 additions & 0 deletions src/min.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* Returns the smallest of the 2 arguments provided
*
* @function min
* @desc Returns the smallest of the 2 arguments provided
* @since v1.0.4
* @param {*} a
* @param {*} b
* @return {*}
**/
import curry from './curry'

export default curry(function min (a, b) {
return b < a ? b : a
})
Loading

0 comments on commit 3cbd611

Please sign in to comment.