rambda 6.9.0 → 7.0.0

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 +69 -1
  2. package/README.md +3811 -3385
  3. package/dist/rambda.esm.js +300 -207
  4. package/dist/rambda.js +303 -206
  5. package/dist/rambda.mjs +300 -207
  6. package/dist/rambda.umd.js +1 -1
  7. package/immutable.d.ts +192 -271
  8. package/index.d.ts +192 -271
  9. package/package.json +111 -98
  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 +3 -3
  18. package/src/_internals/isTruthy.js +5 -5
  19. package/src/_internals/set.js +4 -4
  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 +17 -17
  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 -10
  77. package/src/indexBy.js +11 -11
  78. package/src/indexOf.js +3 -25
  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 +2 -2
  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 +1 -1
  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/ifElse.js CHANGED
@@ -1,13 +1,11 @@
1
- import { curry } from './curry'
1
+ import {curry} from './curry'
2
2
 
3
- function ifElseFn(
4
- condition, onTrue, onFalse
5
- ){
3
+ function ifElseFn(condition, onTrue, onFalse) {
6
4
  return (...input) => {
7
5
  const conditionResult =
8
6
  typeof condition === 'boolean' ? condition : condition(...input)
9
7
 
10
- if (conditionResult === true){
8
+ if (conditionResult === true) {
11
9
  return onTrue(...input)
12
10
  }
13
11
 
package/src/includes.js CHANGED
@@ -1,15 +1,16 @@
1
- import { _isArray } from './_internals/_isArray'
2
- import { _indexOf } from './indexOf'
1
+ import {_isArray} from './_internals/_isArray'
2
+ import {_indexOf} from './equals'
3
3
 
4
- export function includes(valueToFind, input){
5
- if (arguments.length === 1) return _input => includes(valueToFind, _input)
6
- if (typeof input === 'string'){
7
- return input.includes(valueToFind)
4
+ export function includes(valueToFind, iterable) {
5
+ if (arguments.length === 1)
6
+ return _iterable => includes(valueToFind, _iterable)
7
+ if (typeof iterable === 'string') {
8
+ return iterable.includes(valueToFind)
8
9
  }
9
- if (!input){
10
- throw new TypeError(`Cannot read property \'indexOf\' of ${ input }`)
10
+ if (!iterable) {
11
+ throw new TypeError(`Cannot read property \'indexOf\' of ${iterable}`)
11
12
  }
12
- if (!_isArray(input)) return false
13
+ if (!_isArray(iterable)) return false
13
14
 
14
- return _indexOf(valueToFind, input) > -1
15
+ return _indexOf(valueToFind, iterable) > -1
15
16
  }
package/src/indexBy.js CHANGED
@@ -1,28 +1,28 @@
1
- import { path } from './path'
1
+ import {path} from './path'
2
2
 
3
- function indexByPath(pathInput, list){
3
+ function indexByPath(pathInput, list) {
4
4
  const toReturn = {}
5
- for (let i = 0; i < list.length; i++){
6
- const item = list[ i ]
7
- toReturn[ path(pathInput, item) ] = item
5
+ for (let i = 0; i < list.length; i++) {
6
+ const item = list[i]
7
+ toReturn[path(pathInput, item)] = item
8
8
  }
9
9
 
10
10
  return toReturn
11
11
  }
12
12
 
13
- export function indexBy(condition, list){
14
- if (arguments.length === 1){
13
+ export function indexBy(condition, list) {
14
+ if (arguments.length === 1) {
15
15
  return _list => indexBy(condition, _list)
16
16
  }
17
17
 
18
- if (typeof condition === 'string'){
18
+ if (typeof condition === 'string') {
19
19
  return indexByPath(condition, list)
20
20
  }
21
21
 
22
22
  const toReturn = {}
23
- for (let i = 0; i < list.length; i++){
24
- const item = list[ i ]
25
- toReturn[ condition(item) ] = item
23
+ for (let i = 0; i < list.length; i++) {
24
+ const item = list[i]
25
+ toReturn[condition(item)] = item
26
26
  }
27
27
 
28
28
  return toReturn
package/src/indexOf.js CHANGED
@@ -1,29 +1,7 @@
1
- import { equals } from './equals'
2
- import { type } from './type'
3
- import { _isArray } from './_internals/_isArray'
1
+ import {_indexOf} from './equals'
4
2
 
5
- export function _indexOf(valueToFind, list) {
6
- if (!_isArray(list)){
7
- throw new Error(`Cannot read property 'indexOf' of ${list}`)
8
- }
9
- const typeOfValue = type(valueToFind)
10
- if (!['Object', 'Array', 'NaN', 'RegExp'].includes(typeOfValue)) return list.indexOf(valueToFind)
11
-
12
- let index = -1
13
- let foundIndex = -1
14
- const { length } = list
15
-
16
- while (++index < length && foundIndex === -1){
17
- if (equals(list[index], valueToFind)){
18
- foundIndex = index
19
- }
20
- }
21
-
22
- return foundIndex
23
- }
24
-
25
- export function indexOf(valueToFind, list){
26
- if (arguments.length === 1){
3
+ export function indexOf(valueToFind, list) {
4
+ if (arguments.length === 1) {
27
5
  return _list => _indexOf(valueToFind, _list)
28
6
  }
29
7
 
package/src/init.js CHANGED
@@ -1,9 +1,7 @@
1
1
  import baseSlice from './_internals/baseSlice'
2
2
 
3
- export function init(listOrString){
3
+ export function init(listOrString) {
4
4
  if (typeof listOrString === 'string') return listOrString.slice(0, -1)
5
5
 
6
- return listOrString.length ? baseSlice(
7
- listOrString, 0, -1
8
- ) : []
6
+ return listOrString.length ? baseSlice(listOrString, 0, -1) : []
9
7
  }
@@ -1,7 +1,7 @@
1
- import { filter } from './filter'
2
- import { includes } from './includes'
1
+ import {filter} from './filter'
2
+ import {includes} from './includes'
3
3
 
4
- export function intersection(listA, listB){
4
+ export function intersection(listA, listB) {
5
5
  if (arguments.length === 1) return _list => intersection(listA, _list)
6
6
 
7
7
  return filter(x => includes(x, listA), listB)
@@ -1,15 +1,15 @@
1
- export function intersperse(separator, list){
1
+ export function intersperse(separator, list) {
2
2
  if (arguments.length === 1) return _list => intersperse(separator, _list)
3
3
 
4
4
  let index = -1
5
5
  const len = list.length
6
6
  const willReturn = []
7
7
 
8
- while (++index < len){
9
- if (index === len - 1){
10
- willReturn.push(list[ index ])
8
+ while (++index < len) {
9
+ if (index === len - 1) {
10
+ willReturn.push(list[index])
11
11
  } else {
12
- willReturn.push(list[ index ], separator)
12
+ willReturn.push(list[index], separator)
13
13
  }
14
14
  }
15
15
 
package/src/is.js CHANGED
@@ -1,8 +1,8 @@
1
- export function is(targetPrototype, x){
1
+ export function is(targetPrototype, x) {
2
2
  if (arguments.length === 1) return _x => is(targetPrototype, _x)
3
3
 
4
4
  return (
5
- x != null && x.constructor === targetPrototype ||
5
+ (x != null && x.constructor === targetPrototype) ||
6
6
  x instanceof targetPrototype
7
7
  )
8
8
  }
package/src/isEmpty.js CHANGED
@@ -1,16 +1,16 @@
1
- import { type } from './type'
1
+ import {type} from './type'
2
2
 
3
- export function isEmpty(input){
3
+ export function isEmpty(input) {
4
4
  const inputType = type(input)
5
- if ([ 'Undefined', 'NaN', 'Number', 'Null' ].includes(inputType))
5
+ if (['Undefined', 'NaN', 'Number', 'Null'].includes(inputType))
6
6
  return false
7
7
  if (!input) return true
8
8
 
9
- if (inputType === 'Object'){
9
+ if (inputType === 'Object') {
10
10
  return Object.keys(input).length === 0
11
11
  }
12
12
 
13
- if (inputType === 'Array'){
13
+ if (inputType === 'Array') {
14
14
  return input.length === 0
15
15
  }
16
16
 
package/src/isFunction.js CHANGED
@@ -1,5 +1,5 @@
1
- import { type } from './type'
1
+ import {type} from './type'
2
2
 
3
- export function isFunction(fn){
4
- return [ 'Async', 'Function' ].includes(type(fn))
3
+ export function isFunction(fn) {
4
+ return ['Async', 'Function'].includes(type(fn))
5
5
  }
package/src/isNil.js CHANGED
@@ -1,3 +1,3 @@
1
- export function isNil(x){
1
+ export function isNil(x) {
2
2
  return x === undefined || x === null
3
3
  }
package/src/isPromise.js CHANGED
@@ -1,5 +1,5 @@
1
- import { type } from './type'
1
+ import {type} from './type'
2
2
 
3
- export function isPromise(x){
4
- return [ 'Async', 'Promise' ].includes(type(x))
3
+ export function isPromise(x) {
4
+ return ['Async', 'Promise'].includes(type(x))
5
5
  }
package/src/join.js CHANGED
@@ -1,4 +1,4 @@
1
- export function join(glue, list){
1
+ export function join(glue, list) {
2
2
  if (arguments.length === 1) return _list => join(glue, _list)
3
3
 
4
4
  return list.join(glue)
package/src/keys.js CHANGED
@@ -1,3 +1,3 @@
1
- export function keys(x){
1
+ export function keys(x) {
2
2
  return Object.keys(x)
3
3
  }
package/src/last.js CHANGED
@@ -1,7 +1,7 @@
1
- export function last(listOrString){
2
- if (typeof listOrString === 'string'){
3
- return listOrString[ listOrString.length - 1 ] || ''
1
+ export function last(listOrString) {
2
+ if (typeof listOrString === 'string') {
3
+ return listOrString[listOrString.length - 1] || ''
4
4
  }
5
5
 
6
- return listOrString[ listOrString.length - 1 ]
6
+ return listOrString[listOrString.length - 1]
7
7
  }
@@ -1,15 +1,9 @@
1
- import { equals } from './equals'
1
+ import {_lastIndexOf} from './equals'
2
2
 
3
- export function lastIndexOf(target, list){
4
- if (arguments.length === 1) return _list => lastIndexOf(target, _list)
5
-
6
- let index = list.length
7
-
8
- while (--index > 0){
9
- if (equals(list[ index ], target)){
10
- return index
11
- }
3
+ export function lastIndexOf(valueToFind, list) {
4
+ if (arguments.length === 1) {
5
+ return _list => _lastIndexOf(valueToFind, _list)
12
6
  }
13
7
 
14
- return -1
8
+ return _lastIndexOf(valueToFind, list)
15
9
  }
package/src/length.js CHANGED
@@ -1,7 +1,8 @@
1
- export function length(x){
2
- if (!x && x !== '' || x.length === undefined){
3
- return NaN
4
- }
1
+ import {_isArray} from './_internals/_isArray'
5
2
 
6
- return x.length
3
+ export function length(x) {
4
+ if (_isArray(x)) return x.length
5
+ if (typeof x === 'string') return x.length
6
+
7
+ return NaN
7
8
  }
package/src/lens.js CHANGED
@@ -1,6 +1,6 @@
1
- export function lens(getter, setter){
2
- return function (functor){
3
- return function (target){
1
+ export function lens(getter, setter) {
2
+ return function (functor) {
3
+ return function (target) {
4
4
  return functor(getter(target)).map(focus => setter(focus, target))
5
5
  }
6
6
  }
package/src/lensIndex.js CHANGED
@@ -1,7 +1,7 @@
1
- import { lens } from './lens'
2
- import { nth } from './nth'
3
- import { update } from './update'
1
+ import {lens} from './lens'
2
+ import {nth} from './nth'
3
+ import {update} from './update'
4
4
 
5
- export function lensIndex(index){
5
+ export function lensIndex(index) {
6
6
  return lens(nth(index), update(index))
7
7
  }
package/src/lensProp.js CHANGED
@@ -1,7 +1,7 @@
1
- import { assoc } from './assoc'
2
- import { lens } from './lens'
3
- import { prop } from './prop'
1
+ import {assoc} from './assoc'
2
+ import {lens} from './lens'
3
+ import {prop} from './prop'
4
4
 
5
- export function lensProp(key){
5
+ export function lensProp(key) {
6
6
  return lens(prop(key), assoc(key))
7
7
  }
package/src/map.js CHANGED
@@ -1,14 +1,12 @@
1
- import { _isArray } from './_internals/_isArray'
2
- import { _keys } from './_internals/_keys'
1
+ import {_isArray} from './_internals/_isArray'
2
+ import {_keys} from './_internals/_keys'
3
3
 
4
- export function mapArray(
5
- fn, list, isIndexed = false
6
- ){
4
+ export function mapArray(fn, list, isIndexed = false) {
7
5
  let index = 0
8
6
  const willReturn = Array(list.length)
9
7
 
10
- while (index < list.length){
11
- willReturn[ index ] = isIndexed ? fn(list[ index ], index) : fn(list[ index ])
8
+ while (index < list.length) {
9
+ willReturn[index] = isIndexed ? fn(list[index], index) : fn(list[index])
12
10
 
13
11
  index++
14
12
  }
@@ -16,17 +14,15 @@ export function mapArray(
16
14
  return willReturn
17
15
  }
18
16
 
19
- export function mapObject(fn, obj){
17
+ export function mapObject(fn, obj) {
20
18
  let index = 0
21
19
  const keys = _keys(obj)
22
20
  const len = keys.length
23
21
  const willReturn = {}
24
22
 
25
- while (index < len){
26
- const key = keys[ index ]
27
- willReturn[ key ] = fn(
28
- obj[ key ], key, obj
29
- )
23
+ while (index < len) {
24
+ const key = keys[index]
25
+ willReturn[key] = fn(obj[key], key, obj)
30
26
  index++
31
27
  }
32
28
 
@@ -35,10 +31,13 @@ export function mapObject(fn, obj){
35
31
 
36
32
  export const mapObjIndexed = mapObject
37
33
 
38
- export function map(fn, list){
39
- if (arguments.length === 1) return _list => map(fn, _list)
40
- if (list === undefined) return []
41
- if (_isArray(list)) return mapArray(fn, list)
34
+ export function map(fn, iterable) {
35
+ if (arguments.length === 1) return _iterable => map(fn, _iterable)
36
+ if (!iterable) {
37
+ throw new Error('Incorrect iterable input')
38
+ }
39
+
40
+ if (_isArray(iterable)) return mapArray(fn, iterable)
42
41
 
43
- return mapObject(fn, list)
42
+ return mapObject(fn, iterable)
44
43
  }
package/src/match.js CHANGED
@@ -1,4 +1,4 @@
1
- export function match(pattern, input){
1
+ export function match(pattern, input) {
2
2
  if (arguments.length === 1) return _input => match(pattern, _input)
3
3
 
4
4
  const willReturn = input.match(pattern)
package/src/mathMod.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import _isInteger from './_internals/_isInteger'
2
2
 
3
- export function mathMod(x, y){
3
+ export function mathMod(x, y) {
4
4
  if (arguments.length === 1) return _y => mathMod(x, _y)
5
5
  if (!_isInteger(x) || !_isInteger(y) || y < 1) return NaN
6
6
 
7
- return (x % y + y) % y
7
+ return ((x % y) + y) % y
8
8
  }
package/src/max.js CHANGED
@@ -1,4 +1,4 @@
1
- export function max(x, y){
1
+ export function max(x, y) {
2
2
  if (arguments.length === 1) return _y => max(x, _y)
3
3
 
4
4
  return y > x ? y : x
package/src/maxBy.js CHANGED
@@ -1,8 +1,6 @@
1
- import { curry } from './curry'
1
+ import {curry} from './curry'
2
2
 
3
- export function maxByFn(
4
- compareFn, x, y
5
- ){
3
+ export function maxByFn(compareFn, x, y) {
6
4
  return compareFn(y) > compareFn(x) ? y : x
7
5
  }
8
6
 
package/src/maybe.js CHANGED
@@ -1,8 +1,6 @@
1
- import { type } from './type'
1
+ import {type} from './type'
2
2
 
3
- export function maybe(
4
- ifRule, whenIf, whenElse
5
- ){
3
+ export function maybe(ifRule, whenIf, whenElse) {
6
4
  const whenIfInput =
7
5
  ifRule && type(whenIf) === 'Function' ? whenIf() : whenIf
8
6
 
package/src/mean.js CHANGED
@@ -1,5 +1,5 @@
1
- import { sum } from './sum'
1
+ import {sum} from './sum'
2
2
 
3
- export function mean(list){
3
+ export function mean(list) {
4
4
  return sum(list) / list.length
5
5
  }
package/src/median.js CHANGED
@@ -1,17 +1,19 @@
1
- import { mean } from './mean'
1
+ import {mean} from './mean'
2
2
 
3
- export function median(list){
3
+ export function median(list) {
4
4
  const len = list.length
5
5
  if (len === 0) return NaN
6
- const width = 2 - len % 2
6
+ const width = 2 - (len % 2)
7
7
  const idx = (len - width) / 2
8
8
 
9
- return mean(Array.prototype.slice
10
- .call(list, 0)
11
- .sort((a, b) => {
12
- if (a === b) return 0
9
+ return mean(
10
+ Array.prototype.slice
11
+ .call(list, 0)
12
+ .sort((a, b) => {
13
+ if (a === b) return 0
13
14
 
14
- return a < b ? -1 : 1
15
- })
16
- .slice(idx, idx + width))
15
+ return a < b ? -1 : 1
16
+ })
17
+ .slice(idx, idx + width)
18
+ )
17
19
  }
package/src/merge.js CHANGED
@@ -1,7 +1,5 @@
1
- export function merge(target, newProps){
1
+ export function merge(target, newProps) {
2
2
  if (arguments.length === 1) return _newProps => merge(target, _newProps)
3
3
 
4
- return Object.assign(
5
- {}, target || {}, newProps || {}
6
- )
4
+ return Object.assign({}, target || {}, newProps || {})
7
5
  }
package/src/mergeAll.js CHANGED
@@ -1,7 +1,7 @@
1
- import { map } from './map'
2
- import { merge } from './merge'
1
+ import {map} from './map'
2
+ import {merge} from './merge'
3
3
 
4
- export function mergeAll(arr){
4
+ export function mergeAll(arr) {
5
5
  let willReturn = {}
6
6
  map(val => {
7
7
  willReturn = merge(willReturn, val)
@@ -1,21 +1,21 @@
1
- import { type } from './type'
1
+ import {type} from './type'
2
2
 
3
- export function mergeDeepRight(target, source){
4
- if (arguments.length === 1){
3
+ export function mergeDeepRight(target, source) {
4
+ if (arguments.length === 1) {
5
5
  return sourceHolder => mergeDeepRight(target, sourceHolder)
6
6
  }
7
7
 
8
8
  const willReturn = JSON.parse(JSON.stringify(target))
9
9
 
10
10
  Object.keys(source).forEach(key => {
11
- if (type(source[ key ]) === 'Object'){
12
- if (type(target[ key ]) === 'Object'){
13
- willReturn[ key ] = mergeDeepRight(target[ key ], source[ key ])
11
+ if (type(source[key]) === 'Object') {
12
+ if (type(target[key]) === 'Object') {
13
+ willReturn[key] = mergeDeepRight(target[key], source[key])
14
14
  } else {
15
- willReturn[ key ] = source[ key ]
15
+ willReturn[key] = source[key]
16
16
  }
17
17
  } else {
18
- willReturn[ key ] = source[ key ]
18
+ willReturn[key] = source[key]
19
19
  }
20
20
  })
21
21
 
package/src/mergeLeft.js CHANGED
@@ -1,6 +1,6 @@
1
- import { merge } from './merge'
1
+ import {merge} from './merge'
2
2
 
3
- export function mergeLeft(x, y){
3
+ export function mergeLeft(x, y) {
4
4
  if (arguments.length === 1) return _y => mergeLeft(x, _y)
5
5
 
6
6
  return merge(y, x)
package/src/min.js CHANGED
@@ -1,4 +1,4 @@
1
- export function min(x, y){
1
+ export function min(x, y) {
2
2
  if (arguments.length === 1) return _y => min(x, _y)
3
3
 
4
4
  return y < x ? y : x
package/src/minBy.js CHANGED
@@ -1,8 +1,6 @@
1
- import { curry } from './curry'
1
+ import {curry} from './curry'
2
2
 
3
- export function minByFn(
4
- compareFn, x, y
5
- ){
3
+ export function minByFn(compareFn, x, y) {
6
4
  return compareFn(y) < compareFn(x) ? y : x
7
5
  }
8
6
 
package/src/modulo.js CHANGED
@@ -1,4 +1,4 @@
1
- export function modulo(x, y){
1
+ export function modulo(x, y) {
2
2
  if (arguments.length === 1) return _y => modulo(x, _y)
3
3
 
4
4
  return x % y
package/src/move.js CHANGED
@@ -1,16 +1,15 @@
1
- import { curry } from './curry'
1
+ import {curry} from './curry'
2
+ import {cloneList} from './_internals/cloneList'
2
3
 
3
- function moveFn(
4
- fromIndex, toIndex, list
5
- ){
6
- if (fromIndex < 0 || toIndex < 0){
4
+ function moveFn(fromIndex, toIndex, list) {
5
+ if (fromIndex < 0 || toIndex < 0) {
7
6
  throw new Error('Rambda.move does not support negative indexes')
8
7
  }
9
8
  if (fromIndex > list.length - 1 || toIndex > list.length - 1) return list
10
9
 
11
- const clone = list.slice()
12
- clone[ fromIndex ] = list[ toIndex ]
13
- clone[ toIndex ] = list[ fromIndex ]
10
+ const clone = cloneList(list)
11
+ clone[fromIndex] = list[toIndex]
12
+ clone[toIndex] = list[fromIndex]
14
13
 
15
14
  return clone
16
15
  }
package/src/multiply.js CHANGED
@@ -1,4 +1,4 @@
1
- export function multiply(x, y){
1
+ export function multiply(x, y) {
2
2
  if (arguments.length === 1) return _y => multiply(x, _y)
3
3
 
4
4
  return x * y
package/src/negate.js CHANGED
@@ -1,3 +1,3 @@
1
- export function negate(x){
1
+ export function negate(x) {
2
2
  return -x
3
3
  }
package/src/none.js CHANGED
@@ -1,8 +1,8 @@
1
- export function none(predicate, list){
1
+ export function none(predicate, list) {
2
2
  if (arguments.length === 1) return _list => none(predicate, _list)
3
3
 
4
- for (let i = 0; i < list.length; i++){
5
- if (!predicate(list[ i ])) return true
4
+ for (let i = 0; i < list.length; i++) {
5
+ if (!predicate(list[i])) return true
6
6
  }
7
7
 
8
8
  return false
package/src/not.js CHANGED
@@ -1,3 +1,3 @@
1
- export function not(input){
1
+ export function not(input) {
2
2
  return !input
3
3
  }
package/src/nth.js CHANGED
@@ -1,9 +1,9 @@
1
- export function nth(index, list){
1
+ export function nth(index, list) {
2
2
  if (arguments.length === 1) return _list => nth(index, _list)
3
3
 
4
4
  const idx = index < 0 ? list.length + index : index
5
5
 
6
- return Object.prototype.toString.call(list) === '[object String]' ?
7
- list.charAt(idx) :
8
- list[ idx ]
6
+ return Object.prototype.toString.call(list) === '[object String]'
7
+ ? list.charAt(idx)
8
+ : list[idx]
9
9
  }