rambda 7.0.2 → 7.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/CHANGELOG.md +28 -2
  2. package/README.md +3703 -3294
  3. package/dist/rambda.js +284 -78
  4. package/dist/rambda.mjs +270 -78
  5. package/dist/rambda.umd.js +1 -1
  6. package/immutable.d.ts +95 -13
  7. package/index.d.ts +95 -13
  8. package/package.json +119 -119
  9. package/src/F.js +1 -1
  10. package/src/T.js +1 -1
  11. package/src/_internals/_isInteger.js +1 -1
  12. package/src/_internals/_keys.js +0 -1
  13. package/src/_internals/_objectIs.js +2 -7
  14. package/src/_internals/baseSlice.js +8 -6
  15. package/src/_internals/cloneList.js +1 -3
  16. package/src/_internals/createPath.js +3 -0
  17. package/src/_internals/isFalsy.js +5 -5
  18. package/src/_internals/isObject.js +2 -2
  19. package/src/_internals/isTruthy.js +5 -5
  20. package/src/_internals/set.js +19 -13
  21. package/src/add.js +1 -1
  22. package/src/adjust.js +6 -4
  23. package/src/all.js +3 -3
  24. package/src/allPass.js +3 -3
  25. package/src/always.js +2 -2
  26. package/src/and.js +1 -1
  27. package/src/any.js +3 -3
  28. package/src/anyPass.js +3 -3
  29. package/src/append.js +2 -2
  30. package/src/apply.js +2 -2
  31. package/src/applySpec.js +59 -33
  32. package/src/assoc.js +7 -3
  33. package/src/assocPath.js +25 -21
  34. package/src/bind.js +3 -3
  35. package/src/both.js +1 -1
  36. package/src/chain.js +2 -2
  37. package/src/clamp.js +6 -6
  38. package/src/clone.js +10 -10
  39. package/src/complement.js +1 -1
  40. package/src/compose.js +5 -14
  41. package/src/concat.js +2 -2
  42. package/src/cond.js +3 -3
  43. package/src/converge.js +11 -11
  44. package/src/count.js +10 -0
  45. package/src/countBy.js +17 -0
  46. package/src/curry.js +2 -2
  47. package/src/curryN.js +81 -61
  48. package/src/defaultTo.js +3 -3
  49. package/src/difference.js +3 -3
  50. package/src/dissoc.js +4 -4
  51. package/src/divide.js +1 -1
  52. package/src/drop.js +1 -1
  53. package/src/dropLast.js +5 -5
  54. package/src/dropLastWhile.js +12 -12
  55. package/src/dropRepeats.js +6 -6
  56. package/src/dropRepeatsWith.js +7 -7
  57. package/src/dropWhile.js +9 -9
  58. package/src/either.js +2 -2
  59. package/src/endsWith.js +6 -5
  60. package/src/eqProps.js +6 -4
  61. package/src/equals.js +64 -65
  62. package/src/evolve.js +21 -23
  63. package/src/filter.js +21 -15
  64. package/src/find.js +4 -4
  65. package/src/findIndex.js +3 -3
  66. package/src/findLast.js +4 -4
  67. package/src/findLastIndex.js +3 -3
  68. package/src/flatten.js +6 -6
  69. package/src/flip.js +15 -11
  70. package/src/forEach.js +12 -10
  71. package/src/fromPairs.js +2 -2
  72. package/src/groupBy.js +6 -6
  73. package/src/groupWith.js +12 -10
  74. package/src/has.js +1 -1
  75. package/src/hasPath.js +3 -3
  76. package/src/head.js +3 -3
  77. package/src/identical.js +2 -2
  78. package/src/identity.js +1 -1
  79. package/src/ifElse.js +5 -3
  80. package/src/includes.js +6 -6
  81. package/src/indexBy.js +11 -11
  82. package/src/indexOf.js +3 -3
  83. package/src/init.js +7 -3
  84. package/src/intersection.js +3 -3
  85. package/src/intersperse.js +5 -5
  86. package/src/is.js +2 -2
  87. package/src/isEmpty.js +5 -5
  88. package/src/isNil.js +1 -1
  89. package/src/isPromise.js +3 -3
  90. package/src/join.js +1 -1
  91. package/src/juxt.js +3 -0
  92. package/src/keys.js +1 -1
  93. package/src/last.js +4 -4
  94. package/src/lastIndexOf.js +3 -3
  95. package/src/length.js +2 -2
  96. package/src/lens.js +3 -3
  97. package/src/lensIndex.js +4 -4
  98. package/src/lensPath.js +4 -4
  99. package/src/lensProp.js +4 -4
  100. package/src/map.js +15 -11
  101. package/src/match.js +1 -1
  102. package/src/mathMod.js +3 -3
  103. package/src/max.js +1 -1
  104. package/src/maxBy.js +4 -2
  105. package/src/maybe.js +4 -2
  106. package/src/mean.js +2 -2
  107. package/src/median.js +10 -12
  108. package/src/merge.js +1 -5
  109. package/src/mergeAll.js +4 -4
  110. package/src/mergeDeepRight.js +8 -8
  111. package/src/mergeLeft.js +3 -3
  112. package/src/mergeRight.js +7 -0
  113. package/src/mergeWith.js +29 -0
  114. package/src/min.js +1 -1
  115. package/src/minBy.js +4 -2
  116. package/src/modulo.js +1 -1
  117. package/src/move.js +8 -6
  118. package/src/multiply.js +1 -1
  119. package/src/negate.js +1 -1
  120. package/src/none.js +4 -4
  121. package/src/not.js +1 -1
  122. package/src/nth.js +6 -6
  123. package/src/objOf.js +3 -5
  124. package/src/of.js +2 -2
  125. package/src/omit.js +8 -8
  126. package/src/on.js +16 -0
  127. package/src/once.js +6 -6
  128. package/src/or.js +1 -1
  129. package/src/over.js +5 -3
  130. package/src/partial.js +3 -3
  131. package/src/partialObject.js +15 -0
  132. package/src/partition.js +18 -16
  133. package/src/path.js +9 -8
  134. package/src/pathEq.js +6 -4
  135. package/src/pathOr.js +6 -4
  136. package/src/paths.js +3 -3
  137. package/src/pick.js +8 -8
  138. package/src/pickAll.js +9 -9
  139. package/src/pipe.js +85 -13
  140. package/src/pluck.js +4 -4
  141. package/src/prepend.js +3 -3
  142. package/src/product.js +2 -2
  143. package/src/prop.js +2 -2
  144. package/src/propEq.js +5 -3
  145. package/src/propIs.js +6 -4
  146. package/src/propOr.js +6 -4
  147. package/src/propSatisfies.js +10 -0
  148. package/src/props.js +6 -6
  149. package/src/range.js +4 -4
  150. package/src/reduce.js +11 -7
  151. package/src/reject.js +2 -2
  152. package/src/repeat.js +2 -2
  153. package/src/replace.js +4 -2
  154. package/src/reverse.js +4 -3
  155. package/src/set.js +9 -5
  156. package/src/slice.js +4 -2
  157. package/src/sort.js +2 -2
  158. package/src/sortBy.js +2 -2
  159. package/src/split.js +1 -1
  160. package/src/splitAt.js +9 -9
  161. package/src/splitEvery.js +6 -8
  162. package/src/splitWhen.js +10 -10
  163. package/src/startsWith.js +6 -5
  164. package/src/subtract.js +1 -1
  165. package/src/sum.js +1 -1
  166. package/src/symmetricDifference.js +7 -9
  167. package/src/tail.js +2 -2
  168. package/src/take.js +5 -3
  169. package/src/takeLast.js +5 -3
  170. package/src/takeLastWhile.js +7 -7
  171. package/src/takeWhile.js +8 -8
  172. package/src/tap.js +1 -1
  173. package/src/test.js +3 -5
  174. package/src/times.js +4 -4
  175. package/src/toLower.js +1 -1
  176. package/src/toPairs.js +1 -1
  177. package/src/toString.js +1 -1
  178. package/src/toUpper.js +1 -1
  179. package/src/transpose.js +3 -4
  180. package/src/trim.js +1 -1
  181. package/src/tryCatch.js +7 -5
  182. package/src/type.js +5 -5
  183. package/src/unapply.js +2 -2
  184. package/src/union.js +3 -3
  185. package/src/uniq.js +3 -3
  186. package/src/uniqWith.js +12 -8
  187. package/src/unless.js +3 -3
  188. package/src/unwind.js +15 -0
  189. package/src/update.js +8 -4
  190. package/src/values.js +2 -2
  191. package/src/view.js +2 -2
  192. package/src/when.js +4 -2
  193. package/src/where.js +5 -5
  194. package/src/whereAny.js +12 -0
  195. package/src/whereEq.js +7 -9
  196. package/src/without.js +4 -4
  197. package/src/xor.js +2 -2
  198. package/src/zip.js +3 -3
  199. package/src/zipObj.js +6 -4
  200. package/src/zipWith.js +6 -6
  201. package/src/isFunction.js +0 -5
package/src/pipe.js CHANGED
@@ -1,17 +1,89 @@
1
- export function pipe(...fns) {
2
- if (fns.length === 0)
3
- throw new Error('pipe requires at least one argument')
4
-
5
- return (...args) => {
6
- const list = fns.slice()
7
- if (list.length > 0) {
8
- const fn = list.shift()
9
- let result = fn(...args)
10
- while (list.length > 0) {
11
- result = list.shift()(result)
12
- }
1
+ import { reduceFn } from './reduce.js'
13
2
 
14
- return result
3
+ export function _arity(n, fn){
4
+ switch (n){
5
+ case 0:
6
+ return function (){
7
+ return fn.apply(this, arguments)
8
+ }
9
+ case 1:
10
+ return function (a0){
11
+ return fn.apply(this, arguments)
12
+ }
13
+ case 2:
14
+ return function (a0, a1){
15
+ return fn.apply(this, arguments)
16
+ }
17
+ case 3:
18
+ return function (
19
+ a0, a1, a2
20
+ ){
21
+ return fn.apply(this, arguments)
22
+ }
23
+ case 4:
24
+ return function (
25
+ a0, a1, a2, a3
26
+ ){
27
+ return fn.apply(this, arguments)
28
+ }
29
+ case 5:
30
+ return function (
31
+ a0, a1, a2, a3, a4
32
+ ){
33
+ return fn.apply(this, arguments)
34
+ }
35
+ case 6:
36
+ return function (
37
+ a0, a1, a2, a3, a4, a5
38
+ ){
39
+ return fn.apply(this, arguments)
40
+ }
41
+ case 7:
42
+ return function (
43
+ a0, a1, a2, a3, a4, a5, a6
44
+ ){
45
+ return fn.apply(this, arguments)
46
+ }
47
+ case 8:
48
+ return function (
49
+ a0, a1, a2, a3, a4, a5, a6, a7
50
+ ){
51
+ return fn.apply(this, arguments)
15
52
  }
53
+ case 9:
54
+ return function (
55
+ a0, a1, a2, a3, a4, a5, a6, a7, a8
56
+ ){
57
+ return fn.apply(this, arguments)
58
+ }
59
+ case 10:
60
+ return function (
61
+ a0, a1, a2, a3, a4, a5, a6, a7, a8, a9
62
+ ){
63
+ return fn.apply(this, arguments)
64
+ }
65
+ default:
66
+ throw new Error('First argument to _arity must be a non-negative integer no greater than ten')
67
+ }
68
+ }
69
+
70
+ export function _pipe(f, g){
71
+ return function (){
72
+ return g.call(this, f.apply(this, arguments))
16
73
  }
17
74
  }
75
+
76
+ export function pipe(){
77
+ if (arguments.length === 0){
78
+ throw new Error('pipe requires at least one argument')
79
+ }
80
+
81
+ return _arity(arguments[ 0 ].length,
82
+ reduceFn(
83
+ _pipe,
84
+ arguments[ 0 ],
85
+ Array.prototype.slice.call(
86
+ arguments, 1, Infinity
87
+ )
88
+ ))
89
+ }
package/src/pluck.js CHANGED
@@ -1,13 +1,13 @@
1
- import {map} from './map'
1
+ import { map } from './map.js'
2
2
 
3
- export function pluck(property, list) {
3
+ export function pluck(property, list){
4
4
  if (arguments.length === 1) return _list => pluck(property, _list)
5
5
 
6
6
  const willReturn = []
7
7
 
8
8
  map(x => {
9
- if (x[property] !== undefined) {
10
- willReturn.push(x[property])
9
+ if (x[ property ] !== undefined){
10
+ willReturn.push(x[ property ])
11
11
  }
12
12
  }, list)
13
13
 
package/src/prepend.js CHANGED
@@ -1,7 +1,7 @@
1
- export function prepend(x, input) {
1
+ export function prepend(x, input){
2
2
  if (arguments.length === 1) return _input => prepend(x, _input)
3
3
 
4
- if (typeof input === 'string') return [x].concat(input.split(''))
4
+ if (typeof input === 'string') return [ x ].concat(input.split(''))
5
5
 
6
- return [x].concat(input)
6
+ return [ x ].concat(input)
7
7
  }
package/src/product.js CHANGED
@@ -1,4 +1,4 @@
1
- import {multiply} from './multiply'
2
- import {reduce} from './reduce'
1
+ import { multiply } from './multiply.js'
2
+ import { reduce } from './reduce.js'
3
3
 
4
4
  export const product = reduce(multiply, 1)
package/src/prop.js CHANGED
@@ -1,7 +1,7 @@
1
- export function prop(propToFind, obj) {
1
+ export function prop(propToFind, obj){
2
2
  if (arguments.length === 1) return _obj => prop(propToFind, _obj)
3
3
 
4
4
  if (!obj) return undefined
5
5
 
6
- return obj[propToFind]
6
+ return obj[ propToFind ]
7
7
  }
package/src/propEq.js CHANGED
@@ -1,9 +1,11 @@
1
- import {curry} from './curry'
1
+ import { curry } from './curry.js'
2
2
 
3
- function propEqFn(propToFind, valueToMatch, obj) {
3
+ function propEqFn(
4
+ propToFind, valueToMatch, obj
5
+ ){
4
6
  if (!obj) return false
5
7
 
6
- return obj[propToFind] === valueToMatch
8
+ return obj[ propToFind ] === valueToMatch
7
9
  }
8
10
 
9
11
  export const propEq = curry(propEqFn)
package/src/propIs.js CHANGED
@@ -1,8 +1,10 @@
1
- import {curry} from './curry'
2
- import {is} from './is'
1
+ import { curry } from './curry.js'
2
+ import { is } from './is.js'
3
3
 
4
- function propIsFn(targetPrototype, property, obj) {
5
- return is(targetPrototype, obj[property])
4
+ function propIsFn(
5
+ targetPrototype, property, obj
6
+ ){
7
+ return is(targetPrototype, obj[ property ])
6
8
  }
7
9
 
8
10
  export const propIs = curry(propIsFn)
package/src/propOr.js CHANGED
@@ -1,10 +1,12 @@
1
- import {curry} from './curry'
2
- import {defaultTo} from './defaultTo'
1
+ import { curry } from './curry.js'
2
+ import { defaultTo } from './defaultTo.js'
3
3
 
4
- function propOrFn(defaultValue, property, obj) {
4
+ function propOrFn(
5
+ defaultValue, property, obj
6
+ ){
5
7
  if (!obj) return defaultValue
6
8
 
7
- return defaultTo(defaultValue, obj[property])
9
+ return defaultTo(defaultValue, obj[ property ])
8
10
  }
9
11
 
10
12
  export const propOr = curry(propOrFn)
@@ -0,0 +1,10 @@
1
+ import { curry } from './curry.js'
2
+ import { prop } from './prop.js'
3
+
4
+ function propSatisfiesFn(
5
+ predicate, property, obj
6
+ ){
7
+ return predicate(prop(property, obj))
8
+ }
9
+
10
+ export const propSatisfies = curry(propSatisfiesFn)
package/src/props.js CHANGED
@@ -1,13 +1,13 @@
1
- import {_isArray} from './_internals/_isArray'
2
- import {mapArray} from './map'
1
+ import { _isArray } from './_internals/_isArray.js'
2
+ import { mapArray } from './map.js'
3
3
 
4
- export function props(propsToPick, obj) {
5
- if (arguments.length === 1) {
4
+ export function props(propsToPick, obj){
5
+ if (arguments.length === 1){
6
6
  return _obj => props(propsToPick, _obj)
7
7
  }
8
- if (!_isArray(propsToPick)) {
8
+ if (!_isArray(propsToPick)){
9
9
  throw new Error('propsToPick is not a list')
10
10
  }
11
11
 
12
- return mapArray(prop => obj[prop], propsToPick)
12
+ return mapArray(prop => obj[ prop ], propsToPick)
13
13
  }
package/src/range.js CHANGED
@@ -1,7 +1,7 @@
1
- export function range(start, end) {
1
+ export function range(start, end){
2
2
  if (arguments.length === 1) return _end => range(start, _end)
3
3
 
4
- if (Number.isNaN(Number(start)) || Number.isNaN(Number(end))) {
4
+ if (Number.isNaN(Number(start)) || Number.isNaN(Number(end))){
5
5
  throw new TypeError('Both arguments to range must be numbers')
6
6
  }
7
7
 
@@ -10,8 +10,8 @@ export function range(start, end) {
10
10
  const len = end - start
11
11
  const willReturn = Array(len)
12
12
 
13
- for (let i = 0; i < len; i++) {
14
- willReturn[i] = start + i
13
+ for (let i = 0; i < len; i++){
14
+ willReturn[ i ] = start + i
15
15
  }
16
16
 
17
17
  return willReturn
package/src/reduce.js CHANGED
@@ -1,16 +1,20 @@
1
- import {_isArray} from './_internals/_isArray'
2
- import {_keys} from './_internals/_keys'
3
- import {curry} from './curry'
1
+ import { _isArray } from './_internals/_isArray.js'
2
+ import { _keys } from './_internals/_keys.js'
3
+ import { curry } from './curry.js'
4
4
 
5
- function reduceFn(reducer, acc, list) {
6
- if (!_isArray(list)) {
5
+ export function reduceFn(
6
+ reducer, acc, list
7
+ ){
8
+ if (!_isArray(list)){
7
9
  throw new TypeError('reduce: list must be array or iterable')
8
10
  }
9
11
  let index = 0
10
12
  const len = list.length
11
13
 
12
- while (index < len) {
13
- acc = reducer(acc, list[index], index, list)
14
+ while (index < len){
15
+ acc = reducer(
16
+ acc, list[ index ], index, list
17
+ )
14
18
  index++
15
19
  }
16
20
 
package/src/reject.js CHANGED
@@ -1,6 +1,6 @@
1
- import {filter} from './filter'
1
+ import { filter } from './filter.js'
2
2
 
3
- export function reject(predicate, list) {
3
+ export function reject(predicate, list){
4
4
  if (arguments.length === 1) return _list => reject(predicate, _list)
5
5
 
6
6
  return filter(x => !predicate(x), list)
package/src/repeat.js CHANGED
@@ -1,5 +1,5 @@
1
- export function repeat(x, timesToRepeat) {
2
- if (arguments.length === 1) {
1
+ export function repeat(x, timesToRepeat){
2
+ if (arguments.length === 1){
3
3
  return _timesToRepeat => repeat(x, _timesToRepeat)
4
4
  }
5
5
 
package/src/replace.js CHANGED
@@ -1,6 +1,8 @@
1
- import {curry} from './curry'
1
+ import { curry } from './curry.js'
2
2
 
3
- function replaceFn(pattern, replacer, str) {
3
+ function replaceFn(
4
+ pattern, replacer, str
5
+ ){
4
6
  return str.replace(pattern, replacer)
5
7
  }
6
8
 
package/src/reverse.js CHANGED
@@ -1,6 +1,7 @@
1
- export function reverse(listOrString) {
2
- if (typeof listOrString === 'string') {
3
- return listOrString.split('').reverse().join('')
1
+ export function reverse(listOrString){
2
+ if (typeof listOrString === 'string'){
3
+ return listOrString.split('').reverse()
4
+ .join('')
4
5
  }
5
6
 
6
7
  const clone = listOrString.slice()
package/src/set.js CHANGED
@@ -1,9 +1,13 @@
1
- import {always} from './always'
2
- import {curry} from './curry'
3
- import {over} from './over'
1
+ import { always } from './always.js'
2
+ import { curry } from './curry.js'
3
+ import { over } from './over.js'
4
4
 
5
- function setFn(lens, replacer, x) {
6
- return over(lens, always(replacer), x)
5
+ function setFn(
6
+ lens, replacer, x
7
+ ){
8
+ return over(
9
+ lens, always(replacer), x
10
+ )
7
11
  }
8
12
 
9
13
  export const set = curry(setFn)
package/src/slice.js CHANGED
@@ -1,6 +1,8 @@
1
- import {curry} from './curry'
1
+ import { curry } from './curry.js'
2
2
 
3
- function sliceFn(from, to, list) {
3
+ function sliceFn(
4
+ from, to, list
5
+ ){
4
6
  return list.slice(from, to)
5
7
  }
6
8
 
package/src/sort.js CHANGED
@@ -1,6 +1,6 @@
1
- import {cloneList} from './_internals/cloneList'
1
+ import { cloneList } from './_internals/cloneList.js'
2
2
 
3
- export function sort(sortFn, list) {
3
+ export function sort(sortFn, list){
4
4
  if (arguments.length === 1) return _list => sort(sortFn, _list)
5
5
 
6
6
  return cloneList(list).sort(sortFn)
package/src/sortBy.js CHANGED
@@ -1,6 +1,6 @@
1
- import {cloneList} from './_internals/cloneList'
1
+ import { cloneList } from './_internals/cloneList.js'
2
2
 
3
- export function sortBy(sortFn, list) {
3
+ export function sortBy(sortFn, list){
4
4
  if (arguments.length === 1) return _list => sortBy(sortFn, _list)
5
5
 
6
6
  const clone = cloneList(list)
package/src/split.js CHANGED
@@ -1,4 +1,4 @@
1
- export function split(separator, str) {
1
+ export function split(separator, str){
2
2
  if (arguments.length === 1) return _str => split(separator, _str)
3
3
 
4
4
  return str.split(separator)
package/src/splitAt.js CHANGED
@@ -1,15 +1,15 @@
1
- import {_isArray} from './_internals/_isArray'
2
- import {drop} from './drop'
3
- import {maybe} from './maybe'
4
- import {take} from './take'
1
+ import { _isArray } from './_internals/_isArray.js'
2
+ import { drop } from './drop.js'
3
+ import { maybe } from './maybe.js'
4
+ import { take } from './take.js'
5
5
 
6
- export function splitAt(index, input) {
7
- if (arguments.length === 1) {
6
+ export function splitAt(index, input){
7
+ if (arguments.length === 1){
8
8
  return _list => splitAt(index, _list)
9
9
  }
10
- if (!input) throw new TypeError(`Cannot read property 'slice' of ${input}`)
10
+ if (!input) throw new TypeError(`Cannot read property 'slice' of ${ input }`)
11
11
 
12
- if (!_isArray(input) && typeof input !== 'string') return [[], []]
12
+ if (!_isArray(input) && typeof input !== 'string') return [ [], [] ]
13
13
 
14
14
  const correctIndex = maybe(
15
15
  index < 0,
@@ -17,5 +17,5 @@ export function splitAt(index, input) {
17
17
  index
18
18
  )
19
19
 
20
- return [take(correctIndex, input), drop(correctIndex, input)]
20
+ return [ take(correctIndex, input), drop(correctIndex, input) ]
21
21
  }
package/src/splitEvery.js CHANGED
@@ -1,19 +1,17 @@
1
- export function splitEvery(sliceLength, listOrString) {
2
- if (arguments.length === 1) {
1
+ export function splitEvery(sliceLength, listOrString){
2
+ if (arguments.length === 1){
3
3
  return _listOrString => splitEvery(sliceLength, _listOrString)
4
4
  }
5
5
 
6
- if (sliceLength < 1) {
7
- throw new Error(
8
- 'First argument to splitEvery must be a positive integer'
9
- )
6
+ if (sliceLength < 1){
7
+ throw new Error('First argument to splitEvery must be a positive integer')
10
8
  }
11
9
 
12
10
  const willReturn = []
13
11
  let counter = 0
14
12
 
15
- while (counter < listOrString.length) {
16
- willReturn.push(listOrString.slice(counter, (counter += sliceLength)))
13
+ while (counter < listOrString.length){
14
+ willReturn.push(listOrString.slice(counter, counter += sliceLength))
17
15
  }
18
16
 
19
17
  return willReturn
package/src/splitWhen.js CHANGED
@@ -1,25 +1,25 @@
1
- export function splitWhen(predicate, input) {
2
- if (arguments.length === 1) {
1
+ export function splitWhen(predicate, input){
2
+ if (arguments.length === 1){
3
3
  return _input => splitWhen(predicate, _input)
4
4
  }
5
5
  if (!input)
6
- throw new TypeError(`Cannot read property 'length' of ${input}`)
6
+ throw new TypeError(`Cannot read property 'length' of ${ input }`)
7
7
 
8
8
  const preFound = []
9
9
  const postFound = []
10
10
  let found = false
11
11
  let counter = -1
12
12
 
13
- while (counter++ < input.length - 1) {
14
- if (found) {
15
- postFound.push(input[counter])
16
- } else if (predicate(input[counter])) {
17
- postFound.push(input[counter])
13
+ while (counter++ < input.length - 1){
14
+ if (found){
15
+ postFound.push(input[ counter ])
16
+ } else if (predicate(input[ counter ])){
17
+ postFound.push(input[ counter ])
18
18
  found = true
19
19
  } else {
20
- preFound.push(input[counter])
20
+ preFound.push(input[ counter ])
21
21
  }
22
22
  }
23
23
 
24
- return [preFound, postFound]
24
+ return [ preFound, postFound ]
25
25
  }
package/src/startsWith.js CHANGED
@@ -1,11 +1,11 @@
1
- import {equals} from './equals.js'
2
- import {_isArray} from './_internals/_isArray.js'
1
+ import { _isArray } from './_internals/_isArray.js'
2
+ import { equals } from './equals.js'
3
3
 
4
- export function startsWith(target, iterable) {
4
+ export function startsWith(target, iterable){
5
5
  if (arguments.length === 1)
6
6
  return _iterable => startsWith(target, _iterable)
7
7
 
8
- if (typeof iterable === 'string') {
8
+ if (typeof iterable === 'string'){
9
9
  return iterable.startsWith(target)
10
10
  }
11
11
  if (!_isArray(target)) return false
@@ -13,8 +13,9 @@ export function startsWith(target, iterable) {
13
13
  let correct = true
14
14
  const filtered = target.filter((x, index) => {
15
15
  if (!correct) return false
16
- const result = equals(x, iterable[index])
16
+ const result = equals(x, iterable[ index ])
17
17
  if (!result) correct = false
18
+
18
19
  return result
19
20
  })
20
21
 
package/src/subtract.js CHANGED
@@ -1,4 +1,4 @@
1
- export function subtract(a, b) {
1
+ export function subtract(a, b){
2
2
  if (arguments.length === 1) return _b => subtract(a, _b)
3
3
 
4
4
  return a - b
package/src/sum.js CHANGED
@@ -1,3 +1,3 @@
1
- export function sum(list) {
1
+ export function sum(list){
2
2
  return list.reduce((prev, current) => prev + current, 0)
3
3
  }
@@ -1,14 +1,12 @@
1
- import {concat} from './concat'
2
- import {filter} from './filter'
3
- import {includes} from './includes'
1
+ import { concat } from './concat.js'
2
+ import { filter } from './filter.js'
3
+ import { includes } from './includes.js'
4
4
 
5
- export function symmetricDifference(x, y) {
6
- if (arguments.length === 1) {
5
+ export function symmetricDifference(x, y){
6
+ if (arguments.length === 1){
7
7
  return _y => symmetricDifference(x, _y)
8
8
  }
9
9
 
10
- return concat(
11
- filter(value => !includes(value, y), x),
12
- filter(value => !includes(value, x), y)
13
- )
10
+ return concat(filter(value => !includes(value, y), x),
11
+ filter(value => !includes(value, x), y))
14
12
  }
package/src/tail.js CHANGED
@@ -1,5 +1,5 @@
1
- import {drop} from './drop'
1
+ import { drop } from './drop.js'
2
2
 
3
- export function tail(listOrString) {
3
+ export function tail(listOrString){
4
4
  return drop(1, listOrString)
5
5
  }
package/src/take.js CHANGED
@@ -1,10 +1,12 @@
1
- import baseSlice from './_internals/baseSlice'
1
+ import baseSlice from './_internals/baseSlice.js'
2
2
 
3
- export function take(howMany, listOrString) {
3
+ export function take(howMany, listOrString){
4
4
  if (arguments.length === 1)
5
5
  return _listOrString => take(howMany, _listOrString)
6
6
  if (howMany < 0) return listOrString.slice()
7
7
  if (typeof listOrString === 'string') return listOrString.slice(0, howMany)
8
8
 
9
- return baseSlice(listOrString, 0, howMany)
9
+ return baseSlice(
10
+ listOrString, 0, howMany
11
+ )
10
12
  }
package/src/takeLast.js CHANGED
@@ -1,6 +1,6 @@
1
- import baseSlice from './_internals/baseSlice'
1
+ import baseSlice from './_internals/baseSlice.js'
2
2
 
3
- export function takeLast(howMany, listOrString) {
3
+ export function takeLast(howMany, listOrString){
4
4
  if (arguments.length === 1)
5
5
  return _listOrString => takeLast(howMany, _listOrString)
6
6
 
@@ -13,5 +13,7 @@ export function takeLast(howMany, listOrString) {
13
13
 
14
14
  numValue = len - numValue
15
15
 
16
- return baseSlice(listOrString, numValue, len)
16
+ return baseSlice(
17
+ listOrString, numValue, len
18
+ )
17
19
  }
@@ -1,7 +1,7 @@
1
- import {_isArray} from './_internals/_isArray'
1
+ import { _isArray } from './_internals/_isArray.js'
2
2
 
3
- export function takeLastWhile(predicate, input) {
4
- if (arguments.length === 1) {
3
+ export function takeLastWhile(predicate, input){
4
+ if (arguments.length === 1){
5
5
  return _input => takeLastWhile(predicate, _input)
6
6
  }
7
7
  if (input.length === 0) return input
@@ -9,12 +9,12 @@ export function takeLastWhile(predicate, input) {
9
9
  const toReturn = []
10
10
  let counter = input.length
11
11
 
12
- while (!found || counter === 0) {
12
+ while (!found || counter === 0){
13
13
  counter--
14
- if (predicate(input[counter]) === false) {
14
+ if (predicate(input[ counter ]) === false){
15
15
  found = true
16
- } else if (!found) {
17
- toReturn.push(input[counter])
16
+ } else if (!found){
17
+ toReturn.push(input[ counter ])
18
18
  }
19
19
  }
20
20
 
package/src/takeWhile.js CHANGED
@@ -1,22 +1,22 @@
1
- import {_isArray} from '../src/_internals/_isArray'
1
+ import { _isArray } from '../src/_internals/_isArray.js'
2
2
 
3
- export function takeWhile(predicate, iterable) {
4
- if (arguments.length === 1) {
3
+ export function takeWhile(predicate, iterable){
4
+ if (arguments.length === 1){
5
5
  return _iterable => takeWhile(predicate, _iterable)
6
6
  }
7
7
  const isArray = _isArray(iterable)
8
- if (!isArray && typeof iterable !== 'string') {
8
+ if (!isArray && typeof iterable !== 'string'){
9
9
  throw new Error('`iterable` is neither list nor a string')
10
10
  }
11
11
  let flag = true
12
12
  const holder = []
13
13
  let counter = -1
14
14
 
15
- while (counter++ < iterable.length - 1) {
16
- if (!predicate(iterable[counter])) {
15
+ while (counter++ < iterable.length - 1){
16
+ if (!predicate(iterable[ counter ])){
17
17
  if (flag) flag = false
18
- } else if (flag) {
19
- holder.push(iterable[counter])
18
+ } else if (flag){
19
+ holder.push(iterable[ counter ])
20
20
  }
21
21
  }
22
22
  holder
package/src/tap.js CHANGED
@@ -1,4 +1,4 @@
1
- export function tap(fn, x) {
1
+ export function tap(fn, x){
2
2
  if (arguments.length === 1) return _x => tap(fn, _x)
3
3
 
4
4
  fn(x)