rambda 6.8.3 → 7.0.2

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 (188) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/README.md +4157 -4921
  3. package/dist/rambda.esm.js +336 -209
  4. package/dist/rambda.js +340 -209
  5. package/dist/rambda.mjs +336 -209
  6. package/dist/rambda.umd.js +1 -1
  7. package/immutable.d.ts +203 -284
  8. package/index.d.ts +194 -275
  9. package/package.json +119 -95
  10. package/src/F.js +1 -1
  11. package/src/T.js +1 -1
  12. package/src/_internals/_isInteger.js +1 -1
  13. package/src/_internals/_objectIs.js +2 -2
  14. package/src/_internals/baseSlice.js +6 -8
  15. package/src/_internals/cloneList.js +3 -0
  16. package/src/_internals/isFalsy.js +5 -5
  17. package/src/_internals/isObject.js +5 -0
  18. package/src/_internals/isTruthy.js +5 -5
  19. package/src/_internals/set.js +35 -0
  20. package/src/add.js +1 -1
  21. package/src/adjust.js +5 -6
  22. package/src/all.js +3 -3
  23. package/src/allPass.js +4 -4
  24. package/src/always.js +1 -1
  25. package/src/and.js +1 -1
  26. package/src/any.js +3 -3
  27. package/src/anyPass.js +4 -4
  28. package/src/append.js +4 -2
  29. package/src/apply.js +7 -0
  30. package/src/applySpec.js +33 -59
  31. package/src/assoc.js +3 -7
  32. package/src/assocPath.js +22 -25
  33. package/src/bind.js +9 -0
  34. package/src/both.js +1 -1
  35. package/src/chain.js +2 -2
  36. package/src/clamp.js +6 -6
  37. package/src/clone.js +10 -10
  38. package/src/complement.js +1 -1
  39. package/src/compose.js +6 -6
  40. package/src/concat.js +2 -2
  41. package/src/cond.js +3 -3
  42. package/src/converge.js +11 -11
  43. package/src/curry.js +2 -2
  44. package/src/curryN.js +61 -81
  45. package/src/defaultTo.js +5 -8
  46. package/src/difference.js +3 -3
  47. package/src/dissoc.js +4 -4
  48. package/src/divide.js +1 -1
  49. package/src/drop.js +1 -1
  50. package/src/dropLast.js +5 -5
  51. package/src/dropLastWhile.js +12 -12
  52. package/src/dropRepeats.js +6 -6
  53. package/src/dropRepeatsWith.js +7 -7
  54. package/src/dropWhile.js +9 -9
  55. package/src/either.js +2 -2
  56. package/src/endsWith.js +20 -3
  57. package/src/eqProps.js +5 -10
  58. package/src/equals.js +119 -38
  59. package/src/evolve.js +23 -21
  60. package/src/filter.js +18 -18
  61. package/src/find.js +4 -4
  62. package/src/findIndex.js +3 -3
  63. package/src/findLast.js +4 -4
  64. package/src/findLastIndex.js +3 -3
  65. package/src/flatten.js +6 -6
  66. package/src/flip.js +11 -15
  67. package/src/forEach.js +10 -12
  68. package/src/fromPairs.js +2 -2
  69. package/src/groupBy.js +6 -6
  70. package/src/groupWith.js +11 -12
  71. package/src/hasPath.js +5 -5
  72. package/src/head.js +3 -3
  73. package/src/identical.js +1 -1
  74. package/src/identity.js +2 -2
  75. package/src/ifElse.js +3 -5
  76. package/src/includes.js +11 -22
  77. package/src/indexBy.js +11 -11
  78. package/src/indexOf.js +5 -12
  79. package/src/init.js +2 -4
  80. package/src/intersection.js +3 -3
  81. package/src/intersperse.js +5 -5
  82. package/src/is.js +2 -2
  83. package/src/isEmpty.js +5 -5
  84. package/src/isFunction.js +3 -3
  85. package/src/isNil.js +1 -1
  86. package/src/isPromise.js +3 -3
  87. package/src/join.js +1 -1
  88. package/src/keys.js +1 -1
  89. package/src/last.js +4 -4
  90. package/src/lastIndexOf.js +5 -11
  91. package/src/length.js +6 -5
  92. package/src/lens.js +3 -3
  93. package/src/lensIndex.js +4 -4
  94. package/src/lensProp.js +4 -4
  95. package/src/map.js +17 -18
  96. package/src/match.js +1 -1
  97. package/src/mathMod.js +2 -2
  98. package/src/max.js +1 -1
  99. package/src/maxBy.js +2 -4
  100. package/src/maybe.js +2 -4
  101. package/src/mean.js +2 -2
  102. package/src/median.js +12 -10
  103. package/src/merge.js +2 -4
  104. package/src/mergeAll.js +3 -3
  105. package/src/mergeDeepRight.js +8 -8
  106. package/src/mergeLeft.js +2 -2
  107. package/src/min.js +1 -1
  108. package/src/minBy.js +2 -4
  109. package/src/modulo.js +1 -1
  110. package/src/move.js +7 -8
  111. package/src/multiply.js +1 -1
  112. package/src/negate.js +1 -1
  113. package/src/none.js +3 -3
  114. package/src/not.js +1 -1
  115. package/src/nth.js +4 -4
  116. package/src/objOf.js +3 -3
  117. package/src/of.js +2 -2
  118. package/src/omit.js +5 -5
  119. package/src/once.js +6 -6
  120. package/src/or.js +1 -1
  121. package/src/over.js +3 -5
  122. package/src/partial.js +3 -3
  123. package/src/partition.js +17 -15
  124. package/src/path.js +6 -6
  125. package/src/pathEq.js +4 -6
  126. package/src/pathOr.js +5 -7
  127. package/src/paths.js +3 -3
  128. package/src/pick.js +5 -5
  129. package/src/pickAll.js +6 -6
  130. package/src/pipe.js +3 -3
  131. package/src/pluck.js +4 -4
  132. package/src/prepend.js +3 -3
  133. package/src/product.js +2 -2
  134. package/src/prop.js +2 -2
  135. package/src/propEq.js +3 -5
  136. package/src/propIs.js +4 -6
  137. package/src/propOr.js +4 -6
  138. package/src/props.js +6 -6
  139. package/src/range.js +4 -4
  140. package/src/reduce.js +7 -11
  141. package/src/reject.js +2 -2
  142. package/src/repeat.js +2 -2
  143. package/src/replace.js +2 -4
  144. package/src/reverse.js +3 -4
  145. package/src/set.js +5 -9
  146. package/src/slice.js +2 -4
  147. package/src/sort.js +4 -4
  148. package/src/sortBy.js +4 -2
  149. package/src/split.js +1 -1
  150. package/src/splitAt.js +9 -9
  151. package/src/splitEvery.js +8 -6
  152. package/src/splitWhen.js +10 -10
  153. package/src/startsWith.js +20 -3
  154. package/src/subtract.js +1 -1
  155. package/src/sum.js +1 -1
  156. package/src/symmetricDifference.js +9 -7
  157. package/src/tail.js +2 -2
  158. package/src/take.js +2 -4
  159. package/src/takeLast.js +2 -4
  160. package/src/takeLastWhile.js +7 -7
  161. package/src/takeWhile.js +8 -8
  162. package/src/tap.js +1 -1
  163. package/src/test.js +5 -3
  164. package/src/times.js +4 -4
  165. package/src/toLower.js +1 -1
  166. package/src/toPairs.js +1 -1
  167. package/src/toString.js +1 -1
  168. package/src/toUpper.js +1 -1
  169. package/src/transpose.js +4 -3
  170. package/src/trim.js +1 -1
  171. package/src/tryCatch.js +5 -5
  172. package/src/type.js +7 -29
  173. package/src/unapply.js +5 -0
  174. package/src/union.js +4 -3
  175. package/src/uniq.js +7 -10
  176. package/src/uniqWith.js +18 -7
  177. package/src/unless.js +3 -3
  178. package/src/update.js +6 -8
  179. package/src/values.js +2 -2
  180. package/src/view.js +2 -2
  181. package/src/when.js +2 -4
  182. package/src/where.js +5 -5
  183. package/src/whereEq.js +9 -7
  184. package/src/without.js +5 -5
  185. package/src/xor.js +2 -2
  186. package/src/zip.js +3 -3
  187. package/src/zipObj.js +4 -6
  188. package/src/zipWith.js +6 -7
package/src/assoc.js CHANGED
@@ -1,11 +1,7 @@
1
- import { curry } from './curry'
1
+ import {curry} from './curry'
2
2
 
3
- function assocFn(
4
- prop, newValue, obj
5
- ){
6
- return Object.assign(
7
- {}, obj, { [ prop ] : newValue }
8
- )
3
+ function assocFn(prop, newValue, obj) {
4
+ return Object.assign({}, obj, {[prop]: newValue})
9
5
  }
10
6
 
11
7
  export const assoc = curry(assocFn)
package/src/assocPath.js CHANGED
@@ -1,31 +1,30 @@
1
- import { _isArray } from './_internals/_isArray'
2
- import { _isInteger } from './_internals/_isInteger'
3
- import { assoc } from './assoc'
4
- import { curry } from './curry'
5
-
6
- function assocPathFn(
7
- path, newValue, input
8
- ){
1
+ import {_isArray} from './_internals/_isArray'
2
+ import {_isInteger} from './_internals/_isInteger'
3
+ import {assoc} from './assoc'
4
+ import {curry} from './curry'
5
+ import {cloneList} from './_internals/cloneList'
6
+
7
+ function assocPathFn(path, newValue, input) {
9
8
  const pathArrValue =
10
- typeof path === 'string' ?
11
- path.split('.').map(x => _isInteger(Number(x)) ? Number(x) : x) :
12
- path
13
- if (pathArrValue.length === 0){
9
+ typeof path === 'string'
10
+ ? path.split('.').map(x => (_isInteger(Number(x)) ? Number(x) : x))
11
+ : path
12
+ if (pathArrValue.length === 0) {
14
13
  return newValue
15
14
  }
16
15
 
17
- const index = pathArrValue[ 0 ]
18
- if (pathArrValue.length > 1){
16
+ const index = pathArrValue[0]
17
+ if (pathArrValue.length > 1) {
19
18
  const condition =
20
19
  typeof input !== 'object' ||
21
20
  input === null ||
22
21
  !input.hasOwnProperty(index)
23
22
 
24
- const nextinput = condition ?
25
- _isInteger(pathArrValue[ 1 ]) ?
26
- [] :
27
- {} :
28
- input[ index ]
23
+ const nextinput = condition
24
+ ? _isInteger(pathArrValue[1])
25
+ ? []
26
+ : {}
27
+ : input[index]
29
28
 
30
29
  newValue = assocPathFn(
31
30
  Array.prototype.slice.call(pathArrValue, 1),
@@ -34,16 +33,14 @@ function assocPathFn(
34
33
  )
35
34
  }
36
35
 
37
- if (_isInteger(index) && _isArray(input)){
38
- const arr = input.slice()
39
- arr[ index ] = newValue
36
+ if (_isInteger(index) && _isArray(input)) {
37
+ const arr = cloneList(input)
38
+ arr[index] = newValue
40
39
 
41
40
  return arr
42
41
  }
43
42
 
44
- return assoc(
45
- index, newValue, input
46
- )
43
+ return assoc(index, newValue, input)
47
44
  }
48
45
 
49
46
  export const assocPath = curry(assocPathFn)
package/src/bind.js ADDED
@@ -0,0 +1,9 @@
1
+ import {curryN} from './curryN'
2
+
3
+ export function bind(fn, thisObj) {
4
+ if (arguments.length === 1) {
5
+ return _thisObj => bind(fn, _thisObj)
6
+ }
7
+
8
+ return curryN(fn.length, (...args) => fn.apply(thisObj, args))
9
+ }
package/src/both.js CHANGED
@@ -1,4 +1,4 @@
1
- export function both(f, g){
1
+ export function both(f, g) {
2
2
  if (arguments.length === 1) return _g => both(f, _g)
3
3
 
4
4
  return (...input) => f(...input) && g(...input)
package/src/chain.js CHANGED
@@ -1,5 +1,5 @@
1
- export function chain(fn, list){
2
- if (arguments.length === 1){
1
+ export function chain(fn, list) {
2
+ if (arguments.length === 1) {
3
3
  return _list => chain(fn, _list)
4
4
  }
5
5
 
package/src/clamp.js CHANGED
@@ -1,10 +1,10 @@
1
- import { curry } from './curry'
1
+ import {curry} from './curry'
2
2
 
3
- function clampFn(
4
- min, max, input
5
- ){
6
- if (min > max){
7
- throw new Error('min must not be greater than max in clamp(min, max, value)')
3
+ function clampFn(min, max, input) {
4
+ if (min > max) {
5
+ throw new Error(
6
+ 'min must not be greater than max in clamp(min, max, value)'
7
+ )
8
8
  }
9
9
  if (input >= min && input <= max) return input
10
10
 
package/src/clone.js CHANGED
@@ -1,17 +1,17 @@
1
- import { _isArray } from './_internals/_isArray'
1
+ import {_isArray} from './_internals/_isArray'
2
2
 
3
- export function clone(input){
3
+ export function clone(input) {
4
4
  const out = _isArray(input) ? Array(input.length) : {}
5
5
  if (input && input.getTime) return new Date(input.getTime())
6
6
 
7
- for (const key in input){
8
- const v = input[ key ]
9
- out[ key ] =
10
- typeof v === 'object' && v !== null ?
11
- v.getTime ?
12
- new Date(v.getTime()) :
13
- clone(v) :
14
- v
7
+ for (const key in input) {
8
+ const v = input[key]
9
+ out[key] =
10
+ typeof v === 'object' && v !== null
11
+ ? v.getTime
12
+ ? new Date(v.getTime())
13
+ : clone(v)
14
+ : v
15
15
  }
16
16
 
17
17
  return out
package/src/complement.js CHANGED
@@ -1,3 +1,3 @@
1
- export function complement(fn){
1
+ export function complement(fn) {
2
2
  return (...input) => !fn(...input)
3
3
  }
package/src/compose.js CHANGED
@@ -1,14 +1,14 @@
1
- export function compose(...fns){
2
- if (fns.length === 0){
1
+ export function compose(...fns) {
2
+ if (fns.length === 0) {
3
3
  throw new Error('compose requires at least one argument')
4
4
  }
5
5
 
6
- return (...args) => {
6
+ return function (...args) {
7
7
  const list = fns.slice()
8
- if (list.length > 0){
8
+ if (list.length > 0) {
9
9
  const fn = list.pop()
10
- let result = fn(...args)
11
- while (list.length > 0){
10
+ let result = fn.apply(this, args)
11
+ while (list.length > 0) {
12
12
  result = list.pop()(result)
13
13
  }
14
14
 
package/src/concat.js CHANGED
@@ -1,5 +1,5 @@
1
- export function concat(x, y){
1
+ export function concat(x, y) {
2
2
  if (arguments.length === 1) return _y => concat(x, _y)
3
3
 
4
- return typeof x === 'string' ? `${ x }${ y }` : [ ...x, ...y ]
4
+ return typeof x === 'string' ? `${x}${y}` : [...x, ...y]
5
5
  }
package/src/cond.js CHANGED
@@ -1,9 +1,9 @@
1
- export function cond(conditions){
1
+ export function cond(conditions) {
2
2
  return input => {
3
3
  let done = false
4
4
  let toReturn
5
- conditions.forEach(([ predicate, resultClosure ]) => {
6
- if (!done && predicate(input)){
5
+ conditions.forEach(([predicate, resultClosure]) => {
6
+ if (!done && predicate(input)) {
7
7
  done = true
8
8
  toReturn = resultClosure(input)
9
9
  }
package/src/converge.js CHANGED
@@ -1,18 +1,18 @@
1
- import { curryN } from './curryN'
2
- import { map } from './map'
3
- import { max } from './max'
4
- import { reduce } from './reduce'
1
+ import {curryN} from './curryN'
2
+ import {map} from './map'
3
+ import {max} from './max'
4
+ import {reduce} from './reduce'
5
5
 
6
- export function converge(fn, transformers){
6
+ export function converge(fn, transformers) {
7
7
  if (arguments.length === 1)
8
8
  return _transformers => converge(fn, _transformers)
9
9
 
10
- const highestArity = reduce(
11
- (a, b) => max(a, b.length), 0, transformers
12
- )
10
+ const highestArity = reduce((a, b) => max(a, b.length), 0, transformers)
13
11
 
14
- return curryN(highestArity, function (){
15
- return fn.apply(this,
16
- map(g => g.apply(this, arguments), transformers))
12
+ return curryN(highestArity, function () {
13
+ return fn.apply(
14
+ this,
15
+ map(g => g.apply(this, arguments), transformers)
16
+ )
17
17
  })
18
18
  }
package/src/curry.js CHANGED
@@ -1,6 +1,6 @@
1
- export function curry(fn, args = []){
1
+ export function curry(fn, args = []) {
2
2
  return (..._args) =>
3
- (rest => rest.length >= fn.length ? fn(...rest) : curry(fn, rest))([
3
+ (rest => (rest.length >= fn.length ? fn(...rest) : curry(fn, rest)))([
4
4
  ...args,
5
5
  ..._args,
6
6
  ])
package/src/curryN.js CHANGED
@@ -1,103 +1,83 @@
1
- function _curryN(
2
- n, cache, fn
3
- ){
4
- return function (){
1
+ function _curryN(n, cache, fn) {
2
+ return function () {
5
3
  let ci = 0
6
4
  let ai = 0
7
5
  const cl = cache.length
8
6
  const al = arguments.length
9
7
  const args = new Array(cl + al)
10
- while (ci < cl){
11
- args[ ci ] = cache[ ci ]
8
+ while (ci < cl) {
9
+ args[ci] = cache[ci]
12
10
  ci++
13
11
  }
14
- while (ai < al){
15
- args[ cl + ai ] = arguments[ ai ]
12
+ while (ai < al) {
13
+ args[cl + ai] = arguments[ai]
16
14
  ai++
17
15
  }
18
16
  const remaining = n - args.length
19
17
 
20
- return args.length >= n ?
21
- fn.apply(this, args) :
22
- _arity(remaining, _curryN(
23
- n, args, fn
24
- ))
18
+ return args.length >= n
19
+ ? fn.apply(this, args)
20
+ : _arity(remaining, _curryN(n, args, fn))
25
21
  }
26
22
  }
27
23
 
28
- function _arity(n, fn){
29
- switch (n){
30
- case 0:
31
- return function (){
32
- return fn.apply(this, arguments)
33
- }
34
- case 1:
35
- return function (_1){
36
- return fn.apply(this, arguments)
37
- }
38
- case 2:
39
- return function (_1, _2){
40
- return fn.apply(this, arguments)
41
- }
42
- case 3:
43
- return function (
44
- _1, _2, _3
45
- ){
46
- return fn.apply(this, arguments)
47
- }
48
- case 4:
49
- return function (
50
- _1, _2, _3, _4
51
- ){
52
- return fn.apply(this, arguments)
53
- }
54
- case 5:
55
- return function (
56
- _1, _2, _3, _4, _5
57
- ){
58
- return fn.apply(this, arguments)
59
- }
60
- case 6:
61
- return function (
62
- _1, _2, _3, _4, _5, _6
63
- ){
64
- return fn.apply(this, arguments)
65
- }
66
- case 7:
67
- return function (
68
- _1, _2, _3, _4, _5, _6, _7
69
- ){
70
- return fn.apply(this, arguments)
71
- }
72
- case 8:
73
- return function (
74
- _1, _2, _3, _4, _5, _6, _7, _8
75
- ){
76
- return fn.apply(this, arguments)
77
- }
78
- case 9:
79
- return function (
80
- _1, _2, _3, _4, _5, _6, _7, _8, _9
81
- ){
82
- return fn.apply(this, arguments)
83
- }
84
- default:
85
- return function (
86
- _1, _2, _3, _4, _5, _6, _7, _8, _9, _10
87
- ){
88
- return fn.apply(this, arguments)
89
- }
24
+ function _arity(n, fn) {
25
+ switch (n) {
26
+ case 0:
27
+ return function () {
28
+ return fn.apply(this, arguments)
29
+ }
30
+ case 1:
31
+ return function (_1) {
32
+ return fn.apply(this, arguments)
33
+ }
34
+ case 2:
35
+ return function (_1, _2) {
36
+ return fn.apply(this, arguments)
37
+ }
38
+ case 3:
39
+ return function (_1, _2, _3) {
40
+ return fn.apply(this, arguments)
41
+ }
42
+ case 4:
43
+ return function (_1, _2, _3, _4) {
44
+ return fn.apply(this, arguments)
45
+ }
46
+ case 5:
47
+ return function (_1, _2, _3, _4, _5) {
48
+ return fn.apply(this, arguments)
49
+ }
50
+ case 6:
51
+ return function (_1, _2, _3, _4, _5, _6) {
52
+ return fn.apply(this, arguments)
53
+ }
54
+ case 7:
55
+ return function (_1, _2, _3, _4, _5, _6, _7) {
56
+ return fn.apply(this, arguments)
57
+ }
58
+ case 8:
59
+ return function (_1, _2, _3, _4, _5, _6, _7, _8) {
60
+ return fn.apply(this, arguments)
61
+ }
62
+ case 9:
63
+ return function (_1, _2, _3, _4, _5, _6, _7, _8, _9) {
64
+ return fn.apply(this, arguments)
65
+ }
66
+ default:
67
+ return function (_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) {
68
+ return fn.apply(this, arguments)
69
+ }
90
70
  }
91
71
  }
92
72
 
93
- export function curryN(n, fn){
73
+ export function curryN(n, fn) {
94
74
  if (arguments.length === 1) return _fn => curryN(n, _fn)
95
75
 
96
- if (n > 10){
97
- throw new Error('First argument to _arity must be a non-negative integer no greater than ten')
76
+ if (n > 10) {
77
+ throw new Error(
78
+ 'First argument to _arity must be a non-negative integer no greater than ten'
79
+ )
98
80
  }
99
81
 
100
- return _arity(n, _curryN(
101
- n, [], fn
102
- ))
82
+ return _arity(n, _curryN(n, [], fn))
103
83
  }
package/src/defaultTo.js CHANGED
@@ -1,15 +1,12 @@
1
- function isFalsy(input){
1
+ function isFalsy(input) {
2
2
  return (
3
- input === undefined ||
4
- input === null ||
5
- Number.isNaN(input) === true
3
+ input === undefined || input === null || Number.isNaN(input) === true
6
4
  )
7
5
  }
8
6
 
9
- export function defaultTo(defaultArgument, input){
10
- if (arguments.length === 1){
11
- return _input =>
12
- defaultTo(defaultArgument, _input)
7
+ export function defaultTo(defaultArgument, input) {
8
+ if (arguments.length === 1) {
9
+ return _input => defaultTo(defaultArgument, _input)
13
10
  }
14
11
 
15
12
  return isFalsy(input) ? defaultArgument : input
package/src/difference.js CHANGED
@@ -1,7 +1,7 @@
1
- import { includes } from './includes'
2
- import { uniq } from './uniq'
1
+ import {includes} from './includes'
2
+ import {uniq} from './uniq'
3
3
 
4
- export function difference(a, b){
4
+ export function difference(a, b) {
5
5
  if (arguments.length === 1) return _b => difference(a, _b)
6
6
 
7
7
  return uniq(a).filter(aInstance => !includes(aInstance, b))
package/src/dissoc.js CHANGED
@@ -1,13 +1,13 @@
1
- export function dissoc(prop, obj){
1
+ export function dissoc(prop, obj) {
2
2
  if (arguments.length === 1) return _obj => dissoc(prop, _obj)
3
3
 
4
4
  if (obj === null || obj === undefined) return {}
5
5
 
6
6
  const willReturn = {}
7
- for (const p in obj){
8
- willReturn[ p ] = obj[ p ]
7
+ for (const p in obj) {
8
+ willReturn[p] = obj[p]
9
9
  }
10
- delete willReturn[ prop ]
10
+ delete willReturn[prop]
11
11
 
12
12
  return willReturn
13
13
  }
package/src/divide.js CHANGED
@@ -1,4 +1,4 @@
1
- export function divide(a, b){
1
+ export function divide(a, b) {
2
2
  if (arguments.length === 1) return _b => divide(a, _b)
3
3
 
4
4
  return a / b
package/src/drop.js CHANGED
@@ -1,4 +1,4 @@
1
- export function drop(howManyToDrop, listOrString){
1
+ export function drop(howManyToDrop, listOrString) {
2
2
  if (arguments.length === 1) return _list => drop(howManyToDrop, _list)
3
3
 
4
4
  return listOrString.slice(howManyToDrop > 0 ? howManyToDrop : 0)
package/src/dropLast.js CHANGED
@@ -1,9 +1,9 @@
1
- export function dropLast(howManyToDrop, listOrString){
2
- if (arguments.length === 1){
1
+ export function dropLast(howManyToDrop, listOrString) {
2
+ if (arguments.length === 1) {
3
3
  return _listOrString => dropLast(howManyToDrop, _listOrString)
4
4
  }
5
5
 
6
- return howManyToDrop > 0 ?
7
- listOrString.slice(0, -howManyToDrop) :
8
- listOrString.slice()
6
+ return howManyToDrop > 0
7
+ ? listOrString.slice(0, -howManyToDrop)
8
+ : listOrString.slice()
9
9
  }
@@ -1,30 +1,30 @@
1
- import { _isArray } from './_internals/_isArray'
1
+ import {_isArray} from './_internals/_isArray'
2
2
 
3
- export function dropLastWhile(predicate, iterable){
4
- if (arguments.length === 1){
3
+ export function dropLastWhile(predicate, iterable) {
4
+ if (arguments.length === 1) {
5
5
  return _iterable => dropLastWhile(predicate, _iterable)
6
6
  }
7
7
  if (iterable.length === 0) return iterable
8
8
  const isArray = _isArray(iterable)
9
9
 
10
- if (typeof predicate !== 'function'){
11
- throw new Error(`'predicate' is from wrong type ${ typeof predicate }`)
10
+ if (typeof predicate !== 'function') {
11
+ throw new Error(`'predicate' is from wrong type ${typeof predicate}`)
12
12
  }
13
- if (!isArray && typeof iterable !== 'string'){
14
- throw new Error(`'iterable' is from wrong type ${ typeof iterable }`)
13
+ if (!isArray && typeof iterable !== 'string') {
14
+ throw new Error(`'iterable' is from wrong type ${typeof iterable}`)
15
15
  }
16
16
 
17
17
  let found = false
18
18
  const toReturn = []
19
19
  let counter = iterable.length
20
20
 
21
- while (counter > 0){
21
+ while (counter > 0) {
22
22
  counter--
23
- if (!found && predicate(iterable[ counter ]) === false){
23
+ if (!found && predicate(iterable[counter]) === false) {
24
24
  found = true
25
- toReturn.push(iterable[ counter ])
26
- } else if (found){
27
- toReturn.push(iterable[ counter ])
25
+ toReturn.push(iterable[counter])
26
+ } else if (found) {
27
+ toReturn.push(iterable[counter])
28
28
  }
29
29
  }
30
30
 
@@ -1,15 +1,15 @@
1
- import { _isArray } from './_internals/_isArray'
2
- import { equals } from './equals'
1
+ import {_isArray} from './_internals/_isArray'
2
+ import {equals} from './equals'
3
3
 
4
- export function dropRepeats(list){
5
- if (!_isArray(list)){
6
- throw new Error(`${ list } is not a list`)
4
+ export function dropRepeats(list) {
5
+ if (!_isArray(list)) {
6
+ throw new Error(`${list} is not a list`)
7
7
  }
8
8
 
9
9
  const toReturn = []
10
10
 
11
11
  list.reduce((prev, current) => {
12
- if (!equals(prev, current)){
12
+ if (!equals(prev, current)) {
13
13
  toReturn.push(current)
14
14
  }
15
15
 
@@ -1,23 +1,23 @@
1
- import { _isArray } from './_internals/_isArray'
1
+ import {_isArray} from './_internals/_isArray'
2
2
 
3
- export function dropRepeatsWith(predicate, list){
4
- if (arguments.length === 1){
3
+ export function dropRepeatsWith(predicate, list) {
4
+ if (arguments.length === 1) {
5
5
  return _iterable => dropRepeatsWith(predicate, _iterable)
6
6
  }
7
7
 
8
- if (!_isArray(list)){
9
- throw new Error(`${ list } is not a list`)
8
+ if (!_isArray(list)) {
9
+ throw new Error(`${list} is not a list`)
10
10
  }
11
11
 
12
12
  const toReturn = []
13
13
 
14
14
  list.reduce((prev, current) => {
15
- if (prev === undefined){
15
+ if (prev === undefined) {
16
16
  toReturn.push(current)
17
17
 
18
18
  return current
19
19
  }
20
- if (!predicate(prev, current)){
20
+ if (!predicate(prev, current)) {
21
21
  toReturn.push(current)
22
22
  }
23
23
 
package/src/dropWhile.js CHANGED
@@ -1,24 +1,24 @@
1
- import { _isArray } from '../src/_internals/_isArray'
1
+ import {_isArray} from '../src/_internals/_isArray'
2
2
 
3
- export function dropWhile(predicate, iterable){
4
- if (arguments.length === 1){
3
+ export function dropWhile(predicate, iterable) {
4
+ if (arguments.length === 1) {
5
5
  return _iterable => dropWhile(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 = false
12
12
  const holder = []
13
13
  let counter = -1
14
14
 
15
- while (counter++ < iterable.length - 1){
16
- if (flag){
17
- holder.push(iterable[ counter ])
18
- } else if (!predicate(iterable[ counter ])){
15
+ while (counter++ < iterable.length - 1) {
16
+ if (flag) {
17
+ holder.push(iterable[counter])
18
+ } else if (!predicate(iterable[counter])) {
19
19
  if (!flag) flag = true
20
20
 
21
- holder.push(iterable[ counter ])
21
+ holder.push(iterable[counter])
22
22
  }
23
23
  }
24
24
 
package/src/either.js CHANGED
@@ -1,5 +1,5 @@
1
- export function either(firstPredicate, secondPredicate){
2
- if (arguments.length === 1){
1
+ export function either(firstPredicate, secondPredicate) {
2
+ if (arguments.length === 1) {
3
3
  return _secondPredicate => either(firstPredicate, _secondPredicate)
4
4
  }
5
5