rambda 7.3.0 → 7.5.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rambda",
3
- "version": "7.3.0",
3
+ "version": "7.5.0",
4
4
  "scripts": {
5
5
  "publishx": "node files/publish",
6
6
  "populatedocs": "cd ../rambda-scripts && yarn populate:docs",
@@ -21,8 +21,8 @@
21
21
  "lint": "yarn git:add && yarn lint:staged && yarn git:add",
22
22
  "git:add": "git add -A",
23
23
  "build": "yarn build:main && yarn build:web",
24
- "build:web": "cross-env NODE_ENV=build rollup -c files/rollup.web.config.js",
25
- "build:main": "cross-env NODE_ENV=build rollup -c files/rollup.config.js",
24
+ "build:web": "cross-env NODE_ENV=build rollup -c files/rollup.web.config.mjs",
25
+ "build:main": "cross-env NODE_ENV=build rollup -c files/rollup.config.mjs",
26
26
  "docs": "npx docsify-cli init ./docs && yarn fix-docsify",
27
27
  "new": "cd ../rambda-scripts && yarn new",
28
28
  "run:ramda:test": "cd ../rambda-scripts && yarn run:ramda:test",
@@ -44,31 +44,30 @@
44
44
  },
45
45
  "dependencies": {},
46
46
  "devDependencies": {
47
- "@babel/core": "7.18.9",
48
- "@babel/plugin-proposal-object-rest-spread": "7.18.9",
49
- "@babel/preset-env": "7.18.9",
50
- "@rollup/plugin-babel": "5.3.1",
51
- "@rollup/plugin-commonjs": "22.0.1",
52
- "@rollup/plugin-json": "4.1.0",
53
- "@rollup/plugin-node-resolve": "13.3.0",
54
- "@rollup/plugin-replace": "4.0.0",
55
- "@types/jest": "28.1.6",
56
- "@types/ramda": "0.28.15",
47
+ "@babel/core": "7.20.2",
48
+ "@babel/plugin-proposal-object-rest-spread": "7.20.2",
49
+ "@babel/preset-env": "7.20.2",
50
+ "@rollup/plugin-babel": "6.0.2",
51
+ "@rollup/plugin-commonjs": "23.0.2",
52
+ "@rollup/plugin-node-resolve": "15.0.1",
53
+ "@rollup/plugin-replace": "5.0.1",
54
+ "@types/jest": "29.2.2",
55
+ "@types/ramda": "0.28.23",
57
56
  "combinate": "1.1.11",
58
57
  "cross-env": "7.0.3",
59
58
  "dtslint": "4.2.1",
60
59
  "helpers-fn": "1.6.0",
61
60
  "is-ci": "3.0.1",
62
- "jest": "28.1.3",
63
- "jest-extended": "3.0.1",
61
+ "jest": "29.2.2",
62
+ "jest-extended": "3.1.0",
64
63
  "lodash": "4.17.21",
65
- "rambdax": "8.0.1",
64
+ "rambdax": "8.1.0",
66
65
  "ramda": "0.28.0",
67
- "rollup": "2.77.2",
66
+ "rollup": "3.2.5",
68
67
  "rollup-plugin-cleanup": "3.2.1",
69
68
  "rollup-plugin-sourcemaps": "0.6.3",
70
69
  "rollup-plugin-uglify": "6.0.4",
71
- "typescript": "4.7.4"
70
+ "typescript": "4.8.4"
72
71
  },
73
72
  "jest": {
74
73
  "testEnvironment": "node",
@@ -85,10 +84,13 @@
85
84
  "files": [
86
85
  "dist",
87
86
  "src",
87
+ "esm",
88
+ "mjs",
88
89
  "README.md",
89
90
  "CHANGELOG.md",
90
91
  "index.d.ts",
91
92
  "immutable.d.ts",
93
+ "rambda.js",
92
94
  "immutable.js"
93
95
  ],
94
96
  "repository": {
@@ -101,22 +103,8 @@
101
103
  "sideEffects": false,
102
104
  "main": "./dist/rambda.js",
103
105
  "umd": "./dist/rambda.umd.js",
104
- "module": "./dist/rambda.mjs",
106
+ "module": "./rambda.js",
105
107
  "types": "./index.d.ts",
106
- "exports": {
107
- ".": {
108
- "import": "./dist/rambda.mjs",
109
- "require": "./dist/rambda.js",
110
- "default": "./dist/rambda.js",
111
- "types": "./index.d.ts"
112
- },
113
- "./immutable": {
114
- "import": "./immutable.js",
115
- "require": "./immutable.js",
116
- "default": "./immutable.js",
117
- "types": "./immutable.d.ts"
118
- }
119
- },
120
108
  "keywords": [
121
109
  "ramda",
122
110
  "fp",
package/rambda.js ADDED
@@ -0,0 +1,188 @@
1
+ /// <reference types="./index.d.ts" />
2
+ export * from './src/add.js'
3
+ export * from './src/adjust.js'
4
+ export * from './src/all.js'
5
+ export * from './src/allPass.js'
6
+ export * from './src/always.js'
7
+ export * from './src/and.js'
8
+ export * from './src/any.js'
9
+ export * from './src/anyPass.js'
10
+ export * from './src/append.js'
11
+ export * from './src/apply.js'
12
+ export * from './src/applySpec.js'
13
+ export * from './src/assoc.js'
14
+ export * from './src/assocPath.js'
15
+ export * from './src/bind.js'
16
+ export * from './src/both.js'
17
+ export * from './src/chain.js'
18
+ export * from './src/clamp.js'
19
+ export * from './src/clone.js'
20
+ export * from './src/complement.js'
21
+ export * from './src/compose.js'
22
+ export * from './src/concat.js'
23
+ export * from './src/cond.js'
24
+ export * from './src/converge.js'
25
+ export * from './src/count.js'
26
+ export * from './src/countBy.js'
27
+ export * from './src/curry.js'
28
+ export * from './src/curryN.js'
29
+ export * from './src/dec.js'
30
+ export * from './src/defaultTo.js'
31
+ export * from './src/difference.js'
32
+ export * from './src/dissoc.js'
33
+ export * from './src/divide.js'
34
+ export * from './src/drop.js'
35
+ export * from './src/dropLast.js'
36
+ export * from './src/dropLastWhile.js'
37
+ export * from './src/dropRepeats.js'
38
+ export * from './src/dropRepeatsWith.js'
39
+ export * from './src/dropWhile.js'
40
+ export * from './src/either.js'
41
+ export * from './src/endsWith.js'
42
+ export * from './src/eqProps.js'
43
+ export * from './src/equals.js'
44
+ export * from './src/evolve.js'
45
+ export * from './src/F.js'
46
+ export * from './src/filter.js'
47
+ export * from './src/find.js'
48
+ export * from './src/findIndex.js'
49
+ export * from './src/findLast.js'
50
+ export * from './src/findLastIndex.js'
51
+ export * from './src/flatten.js'
52
+ export * from './src/flip.js'
53
+ export * from './src/forEach.js'
54
+ export * from './src/fromPairs.js'
55
+ export * from './src/groupBy.js'
56
+ export * from './src/groupWith.js'
57
+ export * from './src/has.js'
58
+ export * from './src/hasPath.js'
59
+ export * from './src/head.js'
60
+ export * from './src/identical.js'
61
+ export * from './src/identity.js'
62
+ export * from './src/ifElse.js'
63
+ export * from './src/inc.js'
64
+ export * from './src/includes.js'
65
+ export * from './src/indexBy.js'
66
+ export * from './src/indexOf.js'
67
+ export * from './src/init.js'
68
+ export * from './src/intersection.js'
69
+ export * from './src/intersperse.js'
70
+ export * from './src/is.js'
71
+ export * from './src/isEmpty.js'
72
+ export * from './src/isNil.js'
73
+ export * from './src/join.js'
74
+ export * from './src/juxt.js'
75
+ export * from './src/keys.js'
76
+ export * from './src/last.js'
77
+ export * from './src/lastIndexOf.js'
78
+ export * from './src/length.js'
79
+ export * from './src/lens.js'
80
+ export * from './src/lensIndex.js'
81
+ export * from './src/lensPath.js'
82
+ export * from './src/lensProp.js'
83
+ export * from './src/map.js'
84
+ export * from './src/match.js'
85
+ export * from './src/mathMod.js'
86
+ export * from './src/max.js'
87
+ export * from './src/maxBy.js'
88
+ export * from './src/mean.js'
89
+ export * from './src/median.js'
90
+ export * from './src/merge.js'
91
+ export * from './src/mergeAll.js'
92
+ export * from './src/mergeDeepRight.js'
93
+ export * from './src/mergeLeft.js'
94
+ export * from './src/mergeRight.js'
95
+ export * from './src/mergeWith.js'
96
+ export * from './src/min.js'
97
+ export * from './src/minBy.js'
98
+ export * from './src/modify.js'
99
+ export * from './src/modifyPath.js'
100
+ export * from './src/modulo.js'
101
+ export * from './src/move.js'
102
+ export * from './src/multiply.js'
103
+ export * from './src/negate.js'
104
+ export * from './src/none.js'
105
+ export * from './src/nop.js'
106
+ export * from './src/not.js'
107
+ export * from './src/nth.js'
108
+ export * from './src/objOf.js'
109
+ export * from './src/of.js'
110
+ export * from './src/omit.js'
111
+ export * from './src/on.js'
112
+ export * from './src/once.js'
113
+ export * from './src/or.js'
114
+ export * from './src/over.js'
115
+ export * from './src/partial.js'
116
+ export * from './src/partialObject.js'
117
+ export * from './src/partition.js'
118
+ export * from './src/path.js'
119
+ export * from './src/pathEq.js'
120
+ export * from './src/pathOr.js'
121
+ export * from './src/paths.js'
122
+ export * from './src/pick.js'
123
+ export * from './src/pickAll.js'
124
+ export * from './src/pipe.js'
125
+ export * from './src/pluck.js'
126
+ export * from './src/prepend.js'
127
+ export * from './src/product.js'
128
+ export * from './src/prop.js'
129
+ export * from './src/propEq.js'
130
+ export * from './src/propIs.js'
131
+ export * from './src/propOr.js'
132
+ export * from './src/props.js'
133
+ export * from './src/propSatisfies.js'
134
+ export * from './src/range.js'
135
+ export * from './src/reduce.js'
136
+ export * from './src/reject.js'
137
+ export * from './src/repeat.js'
138
+ export * from './src/replace.js'
139
+ export * from './src/reverse.js'
140
+ export * from './src/set.js'
141
+ export * from './src/slice.js'
142
+ export * from './src/sort.js'
143
+ export * from './src/sortBy.js'
144
+ export * from './src/split.js'
145
+ export * from './src/splitAt.js'
146
+ export * from './src/splitEvery.js'
147
+ export * from './src/splitWhen.js'
148
+ export * from './src/startsWith.js'
149
+ export * from './src/subtract.js'
150
+ export * from './src/sum.js'
151
+ export * from './src/symmetricDifference.js'
152
+ export * from './src/T.js'
153
+ export * from './src/tail.js'
154
+ export * from './src/take.js'
155
+ export * from './src/takeLast.js'
156
+ export * from './src/takeLastWhile.js'
157
+ export * from './src/takeWhile.js'
158
+ export * from './src/tap.js'
159
+ export * from './src/test.js'
160
+ export * from './src/times.js'
161
+ export * from './src/toLower.js'
162
+ export * from './src/toPairs.js'
163
+ export * from './src/toString.js'
164
+ export * from './src/toUpper.js'
165
+ export * from './src/transpose.js'
166
+ export * from './src/trim.js'
167
+ export * from './src/tryCatch.js'
168
+ export * from './src/type.js'
169
+ export * from './src/unapply.js'
170
+ export * from './src/union.js'
171
+ export * from './src/uniq.js'
172
+ export * from './src/uniqBy.js'
173
+ export * from './src/uniqWith.js'
174
+ export * from './src/unless.js'
175
+ export * from './src/unnest.js'
176
+ export * from './src/unwind.js'
177
+ export * from './src/update.js'
178
+ export * from './src/values.js'
179
+ export * from './src/view.js'
180
+ export * from './src/when.js'
181
+ export * from './src/where.js'
182
+ export * from './src/whereAny.js'
183
+ export * from './src/whereEq.js'
184
+ export * from './src/without.js'
185
+ export * from './src/xor.js'
186
+ export * from './src/zip.js'
187
+ export * from './src/zipObj.js'
188
+ export * from './src/zipWith.js'
@@ -14,19 +14,20 @@ export function dropLastWhile(predicate, iterable){
14
14
  throw new Error(`'iterable' is from wrong type ${ typeof iterable }`)
15
15
  }
16
16
 
17
- let found = false
18
17
  const toReturn = []
19
18
  let counter = iterable.length
20
19
 
21
- while (counter > 0){
22
- counter--
23
- if (!found && predicate(iterable[ counter ]) === false){
24
- found = true
25
- toReturn.push(iterable[ counter ])
26
- } else if (found){
27
- toReturn.push(iterable[ counter ])
20
+ while (counter){
21
+ const item = iterable[ --counter ]
22
+ if (!predicate(item)){
23
+ toReturn.push(item)
24
+ break
28
25
  }
29
26
  }
30
27
 
28
+ while (counter){
29
+ toReturn.push(iterable[ --counter ])
30
+ }
31
+
31
32
  return isArray ? toReturn.reverse() : toReturn.reverse().join('')
32
33
  }
package/src/dropWhile.js CHANGED
@@ -8,19 +8,21 @@ export function dropWhile(predicate, iterable){
8
8
  if (!isArray && typeof iterable !== 'string'){
9
9
  throw new Error('`iterable` is neither list nor a string')
10
10
  }
11
- let flag = false
12
- const holder = []
13
- let counter = -1
14
11
 
15
- while (counter++ < iterable.length - 1){
16
- if (flag){
17
- holder.push(iterable[ counter ])
18
- } else if (!predicate(iterable[ counter ])){
19
- if (!flag) flag = true
12
+ const toReturn = []
13
+ let counter = 0
20
14
 
21
- holder.push(iterable[ counter ])
15
+ while (counter < iterable.length){
16
+ const item = iterable[ counter++ ]
17
+ if (!predicate(item)){
18
+ toReturn.push(item)
19
+ break
22
20
  }
23
21
  }
24
22
 
25
- return isArray ? holder : holder.join('')
23
+ while (counter < iterable.length){
24
+ toReturn.push(iterable[ counter++ ])
25
+ }
26
+
27
+ return isArray ? toReturn : toReturn.join('')
26
28
  }
package/src/equals.js CHANGED
@@ -84,18 +84,6 @@ function parseRegex(maybeRegex){
84
84
  return [ true, maybeRegex.toString() ]
85
85
  }
86
86
 
87
- function equalsSets(a, b){
88
- if (a.size !== b.size){
89
- return false
90
- }
91
- const aList = _arrayFromIterator(a.values())
92
- const bList = _arrayFromIterator(b.values())
93
-
94
- const filtered = aList.filter(aInstance => _indexOf(aInstance, bList) === -1)
95
-
96
- return filtered.length === 0
97
- }
98
-
99
87
  export function equals(a, b){
100
88
  if (arguments.length === 1) return _b => equals(a, _b)
101
89
 
package/src/map.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { INCORRECT_ITERABLE_INPUT } from './_internals/constants.js'
1
2
  import { isArray } from './_internals/isArray.js'
2
3
  import { keys } from './_internals/keys.js'
3
4
 
package/src/nop.js ADDED
@@ -0,0 +1 @@
1
+ export function nop(){}
@@ -5,17 +5,16 @@ export function takeLastWhile(predicate, input){
5
5
  return _input => takeLastWhile(predicate, _input)
6
6
  }
7
7
  if (input.length === 0) return input
8
- let found = false
8
+
9
9
  const toReturn = []
10
10
  let counter = input.length
11
11
 
12
- while (!found || counter === 0){
13
- counter--
14
- if (predicate(input[ counter ]) === false){
15
- found = true
16
- } else if (!found){
17
- toReturn.push(input[ counter ])
12
+ while (counter){
13
+ const item = input[ --counter ]
14
+ if (!predicate(item)){
15
+ break
18
16
  }
17
+ toReturn.push(item)
19
18
  }
20
19
 
21
20
  return isArray(input) ? toReturn.reverse() : toReturn.reverse().join('')
package/src/takeWhile.js CHANGED
@@ -8,18 +8,17 @@ export function takeWhile(predicate, iterable){
8
8
  if (!isArray && typeof iterable !== 'string'){
9
9
  throw new Error('`iterable` is neither list nor a string')
10
10
  }
11
- let flag = true
12
- const holder = []
13
- let counter = -1
14
11
 
15
- while (counter++ < iterable.length - 1){
16
- if (!predicate(iterable[ counter ])){
17
- if (flag) flag = false
18
- } else if (flag){
19
- holder.push(iterable[ counter ])
12
+ const toReturn = []
13
+ let counter = 0
14
+
15
+ while (counter < iterable.length){
16
+ const item = iterable[ counter++ ]
17
+ if (!predicate(item)){
18
+ break
20
19
  }
20
+ toReturn.push(item)
21
21
  }
22
- holder
23
22
 
24
- return isArray ? holder : holder.join('')
23
+ return isArray ? toReturn : toReturn.join('')
25
24
  }
package/src/test.js CHANGED
@@ -2,7 +2,7 @@ export function test(pattern, str){
2
2
  if (arguments.length === 1) return _str => test(pattern, _str)
3
3
 
4
4
  if (typeof pattern === 'string'){
5
- throw new TypeError(`‘test requires a value of type RegExp as its first argument; received "${ pattern }"`)
5
+ throw new TypeError(`R.test requires a value of type RegExp as its first argument; received "${ pattern }"`)
6
6
  }
7
7
 
8
8
  return str.search(pattern) !== -1
package/src/uniqBy.js CHANGED
@@ -1,13 +1,10 @@
1
+ import { _Set } from '../src/_internals/set.js'
2
+
1
3
  export function uniqBy(fn, list){
2
4
  if (arguments.length === 1){
3
5
  return _list => uniqBy(fn, _list)
4
6
  }
5
- const set = new Set()
6
-
7
- return list.filter(item => {
8
- if (set.has(fn(item))) return false
9
- set.add(fn(item))
7
+ const set = new _Set()
10
8
 
11
- return true
12
- })
9
+ return list.filter(item => set.checkUniqueness(fn(item)))
13
10
  }
package/src/unnest.js ADDED
@@ -0,0 +1,9 @@
1
+ export function unnest(list){
2
+ return list.reduce((acc, item) => {
3
+ if (Array.isArray(item)){
4
+ return [ ...acc, ...item ]
5
+ }
6
+
7
+ return [ ...acc, item ]
8
+ }, [])
9
+ }