@bigbinary/neeto-commons-frontend 2.0.6 → 2.0.7
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/README.md +1 -1
- package/initializers.cjs.js +8 -22
- package/initializers.js +9 -23
- package/package.json +1 -1
- package/pure.cjs.js +32 -31
- package/pure.js +32 -31
- package/utils.cjs.js +1 -7
- package/utils.js +2 -8
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ The commons frontend library for Neeto Applications.
|
|
|
7
7
|
Install from npm:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
yarn add "@bigbinary/neeto-commons-frontend@2.0.
|
|
10
|
+
yarn add "@bigbinary/neeto-commons-frontend@2.0.7"
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
This package relies on the host project's tailwind configuration. So add
|
package/initializers.cjs.js
CHANGED
|
@@ -135,19 +135,20 @@ var keysToCamelCase = function keysToCamelCase(object) {
|
|
|
135
135
|
});
|
|
136
136
|
};
|
|
137
137
|
var serializeKeysToSnakeCase = function serializeKeysToSnakeCase(object) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return
|
|
138
|
+
var serializedObj = typeof (object === null || object === void 0 ? void 0 : object.toJSON) === "function" ? object.toJSON() : object;
|
|
139
|
+
|
|
140
|
+
if (Array.isArray(serializedObj)) {
|
|
141
|
+
return serializedObj.map(serializeKeysToSnakeCase);
|
|
142
|
+
} else if (serializedObj === null || _typeof(serializedObj) !== "object") {
|
|
143
|
+
return serializedObj;
|
|
142
144
|
}
|
|
143
145
|
|
|
144
|
-
return Object.fromEntries(Object.entries(
|
|
146
|
+
return Object.fromEntries(Object.entries(serializedObj).map(function (_ref3) {
|
|
145
147
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
146
148
|
key = _ref4[0],
|
|
147
149
|
value = _ref4[1];
|
|
148
150
|
|
|
149
|
-
|
|
150
|
-
return [camelToSnakeCase(key), serializeKeysToSnakeCase(val)];
|
|
151
|
+
return [camelToSnakeCase(key), serializeKeysToSnakeCase(value)];
|
|
151
152
|
}));
|
|
152
153
|
};
|
|
153
154
|
var deepFreezeObject = function deepFreezeObject(object) {
|
|
@@ -160,21 +161,6 @@ var deepFreezeObject = function deepFreezeObject(object) {
|
|
|
160
161
|
|
|
161
162
|
return object;
|
|
162
163
|
};
|
|
163
|
-
var matches = ramda.curry(function (pattern, object) {
|
|
164
|
-
var __parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
|
|
165
|
-
|
|
166
|
-
if (object === pattern) return true;
|
|
167
|
-
if (typeof pattern === "function" && pattern(object, __parent)) return true;
|
|
168
|
-
if (ramda.isNil(pattern) || ramda.isNil(object)) return false;
|
|
169
|
-
if (_typeof(pattern) !== "object") return false;
|
|
170
|
-
return Object.entries(pattern).every(function (_ref5) {
|
|
171
|
-
var _ref6 = _slicedToArray(_ref5, 2),
|
|
172
|
-
key = _ref6[0],
|
|
173
|
-
value = _ref6[1];
|
|
174
|
-
|
|
175
|
-
return matches(value, object[key], __parent);
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
164
|
|
|
179
165
|
var HEADERS_KEYS = {
|
|
180
166
|
xAuthEmail: "X-Auth-Email",
|
package/initializers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Toastr } from '@bigbinary/neetoui';
|
|
2
2
|
import axios from 'axios';
|
|
3
3
|
import i18next from 'i18next';
|
|
4
|
-
import {
|
|
4
|
+
import { values, evolve, omit, modify, mergeDeepLeft, either, isEmpty, isNil } from 'ramda';
|
|
5
5
|
import { initReactI18next } from 'react-i18next';
|
|
6
6
|
import mixpanel from 'mixpanel-browser';
|
|
7
7
|
|
|
@@ -125,19 +125,20 @@ var keysToCamelCase = function keysToCamelCase(object) {
|
|
|
125
125
|
});
|
|
126
126
|
};
|
|
127
127
|
var serializeKeysToSnakeCase = function serializeKeysToSnakeCase(object) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
return
|
|
128
|
+
var serializedObj = typeof (object === null || object === void 0 ? void 0 : object.toJSON) === "function" ? object.toJSON() : object;
|
|
129
|
+
|
|
130
|
+
if (Array.isArray(serializedObj)) {
|
|
131
|
+
return serializedObj.map(serializeKeysToSnakeCase);
|
|
132
|
+
} else if (serializedObj === null || _typeof(serializedObj) !== "object") {
|
|
133
|
+
return serializedObj;
|
|
132
134
|
}
|
|
133
135
|
|
|
134
|
-
return Object.fromEntries(Object.entries(
|
|
136
|
+
return Object.fromEntries(Object.entries(serializedObj).map(function (_ref3) {
|
|
135
137
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
136
138
|
key = _ref4[0],
|
|
137
139
|
value = _ref4[1];
|
|
138
140
|
|
|
139
|
-
|
|
140
|
-
return [camelToSnakeCase(key), serializeKeysToSnakeCase(val)];
|
|
141
|
+
return [camelToSnakeCase(key), serializeKeysToSnakeCase(value)];
|
|
141
142
|
}));
|
|
142
143
|
};
|
|
143
144
|
var deepFreezeObject = function deepFreezeObject(object) {
|
|
@@ -150,21 +151,6 @@ var deepFreezeObject = function deepFreezeObject(object) {
|
|
|
150
151
|
|
|
151
152
|
return object;
|
|
152
153
|
};
|
|
153
|
-
var matches = curry(function (pattern, object) {
|
|
154
|
-
var __parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
|
|
155
|
-
|
|
156
|
-
if (object === pattern) return true;
|
|
157
|
-
if (typeof pattern === "function" && pattern(object, __parent)) return true;
|
|
158
|
-
if (isNil(pattern) || isNil(object)) return false;
|
|
159
|
-
if (_typeof(pattern) !== "object") return false;
|
|
160
|
-
return Object.entries(pattern).every(function (_ref5) {
|
|
161
|
-
var _ref6 = _slicedToArray(_ref5, 2),
|
|
162
|
-
key = _ref6[0],
|
|
163
|
-
value = _ref6[1];
|
|
164
|
-
|
|
165
|
-
return matches(value, object[key], __parent);
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
154
|
|
|
169
155
|
var HEADERS_KEYS = {
|
|
170
156
|
xAuthEmail: "X-Auth-Email",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-commons-frontend",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
4
4
|
"description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
package/pure.cjs.js
CHANGED
|
@@ -134,19 +134,20 @@ var keysToSnakeCase = function keysToSnakeCase(object) {
|
|
|
134
134
|
});
|
|
135
135
|
};
|
|
136
136
|
var serializeKeysToSnakeCase = function serializeKeysToSnakeCase(object) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return
|
|
137
|
+
var serializedObj = typeof (object === null || object === void 0 ? void 0 : object.toJSON) === "function" ? object.toJSON() : object;
|
|
138
|
+
|
|
139
|
+
if (Array.isArray(serializedObj)) {
|
|
140
|
+
return serializedObj.map(serializeKeysToSnakeCase);
|
|
141
|
+
} else if (serializedObj === null || _typeof(serializedObj) !== "object") {
|
|
142
|
+
return serializedObj;
|
|
141
143
|
}
|
|
142
144
|
|
|
143
|
-
return Object.fromEntries(Object.entries(
|
|
145
|
+
return Object.fromEntries(Object.entries(serializedObj).map(function (_ref3) {
|
|
144
146
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
145
147
|
key = _ref4[0],
|
|
146
148
|
value = _ref4[1];
|
|
147
149
|
|
|
148
|
-
|
|
149
|
-
return [camelToSnakeCase(key), serializeKeysToSnakeCase(val)];
|
|
150
|
+
return [camelToSnakeCase(key), serializeKeysToSnakeCase(value)];
|
|
150
151
|
}));
|
|
151
152
|
};
|
|
152
153
|
var deepFreezeObject = function deepFreezeObject(object) {
|
|
@@ -159,7 +160,7 @@ var deepFreezeObject = function deepFreezeObject(object) {
|
|
|
159
160
|
|
|
160
161
|
return object;
|
|
161
162
|
};
|
|
162
|
-
var matches = ramda.curry(function (pattern, object) {
|
|
163
|
+
var matches = /*#__PURE__*/ramda.curry(function (pattern, object) {
|
|
163
164
|
var __parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
|
|
164
165
|
|
|
165
166
|
if (object === pattern) return true;
|
|
@@ -207,71 +208,71 @@ function _defineProperty(obj, key, value) {
|
|
|
207
208
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
208
209
|
|
|
209
210
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
210
|
-
var removeById = ramda.curry(function (id, array) {
|
|
211
|
+
var removeById = /*#__PURE__*/ramda.curry(function (id, array) {
|
|
211
212
|
return array.filter(function (item) {
|
|
212
213
|
return item.id !== id;
|
|
213
214
|
});
|
|
214
215
|
});
|
|
215
|
-
var findById = ramda.curry(function (id, array) {
|
|
216
|
+
var findById = /*#__PURE__*/ramda.curry(function (id, array) {
|
|
216
217
|
return array.find(function (item) {
|
|
217
218
|
return item.id === id;
|
|
218
219
|
});
|
|
219
220
|
});
|
|
220
|
-
var replaceById = ramda.curry(function (id, newItem, array) {
|
|
221
|
+
var replaceById = /*#__PURE__*/ramda.curry(function (id, newItem, array) {
|
|
221
222
|
return array.map(function (item) {
|
|
222
223
|
return item.id === id ? newItem : item;
|
|
223
224
|
});
|
|
224
225
|
});
|
|
225
|
-
var modifyById = ramda.curry(function (id, modifier, array) {
|
|
226
|
+
var modifyById = /*#__PURE__*/ramda.curry(function (id, modifier, array) {
|
|
226
227
|
return array.map(function (item) {
|
|
227
228
|
return item.id === id ? modifier(item) : item;
|
|
228
229
|
});
|
|
229
230
|
});
|
|
230
|
-
var findBy = ramda.curry(function (pattern, array) {
|
|
231
|
+
var findBy = /*#__PURE__*/ramda.curry(function (pattern, array) {
|
|
231
232
|
return array.find(matches(pattern));
|
|
232
233
|
});
|
|
233
|
-
var removeBy = ramda.curry(function (pattern, array) {
|
|
234
|
+
var removeBy = /*#__PURE__*/ramda.curry(function (pattern, array) {
|
|
234
235
|
return array.filter(ramda.complement(matches(pattern)));
|
|
235
236
|
});
|
|
236
|
-
var replaceBy = ramda.curry(function (pattern, newItem, array) {
|
|
237
|
+
var replaceBy = /*#__PURE__*/ramda.curry(function (pattern, newItem, array) {
|
|
237
238
|
return array.map(function (item) {
|
|
238
239
|
return matches(pattern, item) ? newItem : item;
|
|
239
240
|
});
|
|
240
241
|
});
|
|
241
|
-
var modifyBy = ramda.curry(function (pattern, modifier, array) {
|
|
242
|
+
var modifyBy = /*#__PURE__*/ramda.curry(function (pattern, modifier, array) {
|
|
242
243
|
return array.map(function (item) {
|
|
243
244
|
return matches(pattern, item) ? modifier(item) : item;
|
|
244
245
|
});
|
|
245
246
|
});
|
|
246
|
-
var existsById = ramda.curry(function (id, array) {
|
|
247
|
+
var existsById = /*#__PURE__*/ramda.curry(function (id, array) {
|
|
247
248
|
return array.some(function (item) {
|
|
248
249
|
return item.id === id;
|
|
249
250
|
});
|
|
250
251
|
});
|
|
251
|
-
var existsBy = ramda.curry(function (pattern, array) {
|
|
252
|
+
var existsBy = /*#__PURE__*/ramda.curry(function (pattern, array) {
|
|
252
253
|
return array.some(matches(pattern));
|
|
253
254
|
});
|
|
254
|
-
var findLastBy = ramda.curry(function (pattern, array) {
|
|
255
|
+
var findLastBy = /*#__PURE__*/ramda.curry(function (pattern, array) {
|
|
255
256
|
return ramda.findLast(matches(pattern), array);
|
|
256
257
|
});
|
|
257
|
-
var findIndexById = ramda.curry(function (id, array) {
|
|
258
|
+
var findIndexById = /*#__PURE__*/ramda.curry(function (id, array) {
|
|
258
259
|
return array.findIndex(function (item) {
|
|
259
260
|
return item.id === id;
|
|
260
261
|
});
|
|
261
262
|
});
|
|
262
|
-
var findIndexBy = ramda.curry(function (pattern, array) {
|
|
263
|
+
var findIndexBy = /*#__PURE__*/ramda.curry(function (pattern, array) {
|
|
263
264
|
return array.findIndex(matches(pattern));
|
|
264
265
|
});
|
|
265
|
-
var findLastIndexBy = ramda.curry(function (pattern, array) {
|
|
266
|
+
var findLastIndexBy = /*#__PURE__*/ramda.curry(function (pattern, array) {
|
|
266
267
|
return ramda.findLastIndex(matches(pattern), array);
|
|
267
268
|
});
|
|
268
|
-
var filterBy = ramda.curry(function (pattern, array) {
|
|
269
|
+
var filterBy = /*#__PURE__*/ramda.curry(function (pattern, array) {
|
|
269
270
|
return array.filter(matches(pattern));
|
|
270
271
|
});
|
|
271
|
-
var countBy = ramda.curry(function (pattern, array) {
|
|
272
|
+
var countBy = /*#__PURE__*/ramda.curry(function (pattern, array) {
|
|
272
273
|
return ramda.count(matches(pattern), array);
|
|
273
274
|
});
|
|
274
|
-
var copyKeys = ramda.curry(function (keyMap, objectArray) {
|
|
275
|
+
var copyKeys = /*#__PURE__*/ramda.curry(function (keyMap, objectArray) {
|
|
275
276
|
return objectArray.map(function (object) {
|
|
276
277
|
var shallowCopy = _objectSpread({}, object);
|
|
277
278
|
|
|
@@ -282,7 +283,7 @@ var copyKeys = ramda.curry(function (keyMap, objectArray) {
|
|
|
282
283
|
return shallowCopy;
|
|
283
284
|
});
|
|
284
285
|
});
|
|
285
|
-
var renameKeys = ramda.curry(function (keyMap, objectArray) {
|
|
286
|
+
var renameKeys = /*#__PURE__*/ramda.curry(function (keyMap, objectArray) {
|
|
286
287
|
return objectArray.map(function (object) {
|
|
287
288
|
var shallowCopy = _objectSpread({}, object);
|
|
288
289
|
|
|
@@ -294,7 +295,7 @@ var renameKeys = ramda.curry(function (keyMap, objectArray) {
|
|
|
294
295
|
return shallowCopy;
|
|
295
296
|
});
|
|
296
297
|
});
|
|
297
|
-
var copyKeysDeep = ramda.curry(function (keyMap, objectArray) {
|
|
298
|
+
var copyKeysDeep = /*#__PURE__*/ramda.curry(function (keyMap, objectArray) {
|
|
298
299
|
var copyKeysSingleObject = function copyKeysSingleObject(object, keyMap) {
|
|
299
300
|
var root = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
|
|
300
301
|
return _objectSpread(_objectSpread({}, object), ramda.fromPairs(ramda.toPairs(keyMap).map(function (_ref) {
|
|
@@ -355,13 +356,13 @@ var dynamicArray = function dynamicArray(count, elementGenerator) {
|
|
|
355
356
|
return elementGenerator(index);
|
|
356
357
|
});
|
|
357
358
|
};
|
|
358
|
-
var isNotNil = ramda.complement(ramda.isNil);
|
|
359
|
-
var isNotEmpty = ramda.complement(ramda.isEmpty);
|
|
360
|
-
var notEquals = ramda.curry(function (x, y) {
|
|
359
|
+
var isNotNil = /*#__PURE__*/ramda.complement(ramda.isNil);
|
|
360
|
+
var isNotEmpty = /*#__PURE__*/ramda.complement(ramda.isEmpty);
|
|
361
|
+
var notEquals = /*#__PURE__*/ramda.curry(function (x, y) {
|
|
361
362
|
return x !== y;
|
|
362
363
|
});
|
|
363
364
|
var isNot = notEquals;
|
|
364
|
-
var notEqualsDeep = ramda.complement(ramda.equals);
|
|
365
|
+
var notEqualsDeep = /*#__PURE__*/ramda.complement(ramda.equals);
|
|
365
366
|
var isNotEqualDeep = notEqualsDeep;
|
|
366
367
|
|
|
367
368
|
exports.camelToSnakeCase = camelToSnakeCase;
|
package/pure.js
CHANGED
|
@@ -130,19 +130,20 @@ var keysToSnakeCase = function keysToSnakeCase(object) {
|
|
|
130
130
|
});
|
|
131
131
|
};
|
|
132
132
|
var serializeKeysToSnakeCase = function serializeKeysToSnakeCase(object) {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return
|
|
133
|
+
var serializedObj = typeof (object === null || object === void 0 ? void 0 : object.toJSON) === "function" ? object.toJSON() : object;
|
|
134
|
+
|
|
135
|
+
if (Array.isArray(serializedObj)) {
|
|
136
|
+
return serializedObj.map(serializeKeysToSnakeCase);
|
|
137
|
+
} else if (serializedObj === null || _typeof(serializedObj) !== "object") {
|
|
138
|
+
return serializedObj;
|
|
137
139
|
}
|
|
138
140
|
|
|
139
|
-
return Object.fromEntries(Object.entries(
|
|
141
|
+
return Object.fromEntries(Object.entries(serializedObj).map(function (_ref3) {
|
|
140
142
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
141
143
|
key = _ref4[0],
|
|
142
144
|
value = _ref4[1];
|
|
143
145
|
|
|
144
|
-
|
|
145
|
-
return [camelToSnakeCase(key), serializeKeysToSnakeCase(val)];
|
|
146
|
+
return [camelToSnakeCase(key), serializeKeysToSnakeCase(value)];
|
|
146
147
|
}));
|
|
147
148
|
};
|
|
148
149
|
var deepFreezeObject = function deepFreezeObject(object) {
|
|
@@ -155,7 +156,7 @@ var deepFreezeObject = function deepFreezeObject(object) {
|
|
|
155
156
|
|
|
156
157
|
return object;
|
|
157
158
|
};
|
|
158
|
-
var matches = curry(function (pattern, object) {
|
|
159
|
+
var matches = /*#__PURE__*/curry(function (pattern, object) {
|
|
159
160
|
var __parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
|
|
160
161
|
|
|
161
162
|
if (object === pattern) return true;
|
|
@@ -203,71 +204,71 @@ function _defineProperty(obj, key, value) {
|
|
|
203
204
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
204
205
|
|
|
205
206
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
206
|
-
var removeById = curry(function (id, array) {
|
|
207
|
+
var removeById = /*#__PURE__*/curry(function (id, array) {
|
|
207
208
|
return array.filter(function (item) {
|
|
208
209
|
return item.id !== id;
|
|
209
210
|
});
|
|
210
211
|
});
|
|
211
|
-
var findById = curry(function (id, array) {
|
|
212
|
+
var findById = /*#__PURE__*/curry(function (id, array) {
|
|
212
213
|
return array.find(function (item) {
|
|
213
214
|
return item.id === id;
|
|
214
215
|
});
|
|
215
216
|
});
|
|
216
|
-
var replaceById = curry(function (id, newItem, array) {
|
|
217
|
+
var replaceById = /*#__PURE__*/curry(function (id, newItem, array) {
|
|
217
218
|
return array.map(function (item) {
|
|
218
219
|
return item.id === id ? newItem : item;
|
|
219
220
|
});
|
|
220
221
|
});
|
|
221
|
-
var modifyById = curry(function (id, modifier, array) {
|
|
222
|
+
var modifyById = /*#__PURE__*/curry(function (id, modifier, array) {
|
|
222
223
|
return array.map(function (item) {
|
|
223
224
|
return item.id === id ? modifier(item) : item;
|
|
224
225
|
});
|
|
225
226
|
});
|
|
226
|
-
var findBy = curry(function (pattern, array) {
|
|
227
|
+
var findBy = /*#__PURE__*/curry(function (pattern, array) {
|
|
227
228
|
return array.find(matches(pattern));
|
|
228
229
|
});
|
|
229
|
-
var removeBy = curry(function (pattern, array) {
|
|
230
|
+
var removeBy = /*#__PURE__*/curry(function (pattern, array) {
|
|
230
231
|
return array.filter(complement(matches(pattern)));
|
|
231
232
|
});
|
|
232
|
-
var replaceBy = curry(function (pattern, newItem, array) {
|
|
233
|
+
var replaceBy = /*#__PURE__*/curry(function (pattern, newItem, array) {
|
|
233
234
|
return array.map(function (item) {
|
|
234
235
|
return matches(pattern, item) ? newItem : item;
|
|
235
236
|
});
|
|
236
237
|
});
|
|
237
|
-
var modifyBy = curry(function (pattern, modifier, array) {
|
|
238
|
+
var modifyBy = /*#__PURE__*/curry(function (pattern, modifier, array) {
|
|
238
239
|
return array.map(function (item) {
|
|
239
240
|
return matches(pattern, item) ? modifier(item) : item;
|
|
240
241
|
});
|
|
241
242
|
});
|
|
242
|
-
var existsById = curry(function (id, array) {
|
|
243
|
+
var existsById = /*#__PURE__*/curry(function (id, array) {
|
|
243
244
|
return array.some(function (item) {
|
|
244
245
|
return item.id === id;
|
|
245
246
|
});
|
|
246
247
|
});
|
|
247
|
-
var existsBy = curry(function (pattern, array) {
|
|
248
|
+
var existsBy = /*#__PURE__*/curry(function (pattern, array) {
|
|
248
249
|
return array.some(matches(pattern));
|
|
249
250
|
});
|
|
250
|
-
var findLastBy = curry(function (pattern, array) {
|
|
251
|
+
var findLastBy = /*#__PURE__*/curry(function (pattern, array) {
|
|
251
252
|
return findLast(matches(pattern), array);
|
|
252
253
|
});
|
|
253
|
-
var findIndexById = curry(function (id, array) {
|
|
254
|
+
var findIndexById = /*#__PURE__*/curry(function (id, array) {
|
|
254
255
|
return array.findIndex(function (item) {
|
|
255
256
|
return item.id === id;
|
|
256
257
|
});
|
|
257
258
|
});
|
|
258
|
-
var findIndexBy = curry(function (pattern, array) {
|
|
259
|
+
var findIndexBy = /*#__PURE__*/curry(function (pattern, array) {
|
|
259
260
|
return array.findIndex(matches(pattern));
|
|
260
261
|
});
|
|
261
|
-
var findLastIndexBy = curry(function (pattern, array) {
|
|
262
|
+
var findLastIndexBy = /*#__PURE__*/curry(function (pattern, array) {
|
|
262
263
|
return findLastIndex(matches(pattern), array);
|
|
263
264
|
});
|
|
264
|
-
var filterBy = curry(function (pattern, array) {
|
|
265
|
+
var filterBy = /*#__PURE__*/curry(function (pattern, array) {
|
|
265
266
|
return array.filter(matches(pattern));
|
|
266
267
|
});
|
|
267
|
-
var countBy = curry(function (pattern, array) {
|
|
268
|
+
var countBy = /*#__PURE__*/curry(function (pattern, array) {
|
|
268
269
|
return count(matches(pattern), array);
|
|
269
270
|
});
|
|
270
|
-
var copyKeys = curry(function (keyMap, objectArray) {
|
|
271
|
+
var copyKeys = /*#__PURE__*/curry(function (keyMap, objectArray) {
|
|
271
272
|
return objectArray.map(function (object) {
|
|
272
273
|
var shallowCopy = _objectSpread({}, object);
|
|
273
274
|
|
|
@@ -278,7 +279,7 @@ var copyKeys = curry(function (keyMap, objectArray) {
|
|
|
278
279
|
return shallowCopy;
|
|
279
280
|
});
|
|
280
281
|
});
|
|
281
|
-
var renameKeys = curry(function (keyMap, objectArray) {
|
|
282
|
+
var renameKeys = /*#__PURE__*/curry(function (keyMap, objectArray) {
|
|
282
283
|
return objectArray.map(function (object) {
|
|
283
284
|
var shallowCopy = _objectSpread({}, object);
|
|
284
285
|
|
|
@@ -290,7 +291,7 @@ var renameKeys = curry(function (keyMap, objectArray) {
|
|
|
290
291
|
return shallowCopy;
|
|
291
292
|
});
|
|
292
293
|
});
|
|
293
|
-
var copyKeysDeep = curry(function (keyMap, objectArray) {
|
|
294
|
+
var copyKeysDeep = /*#__PURE__*/curry(function (keyMap, objectArray) {
|
|
294
295
|
var copyKeysSingleObject = function copyKeysSingleObject(object, keyMap) {
|
|
295
296
|
var root = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
|
|
296
297
|
return _objectSpread(_objectSpread({}, object), fromPairs(toPairs(keyMap).map(function (_ref) {
|
|
@@ -351,13 +352,13 @@ var dynamicArray = function dynamicArray(count, elementGenerator) {
|
|
|
351
352
|
return elementGenerator(index);
|
|
352
353
|
});
|
|
353
354
|
};
|
|
354
|
-
var isNotNil = complement(isNil);
|
|
355
|
-
var isNotEmpty = complement(isEmpty);
|
|
356
|
-
var notEquals = curry(function (x, y) {
|
|
355
|
+
var isNotNil = /*#__PURE__*/complement(isNil);
|
|
356
|
+
var isNotEmpty = /*#__PURE__*/complement(isEmpty);
|
|
357
|
+
var notEquals = /*#__PURE__*/curry(function (x, y) {
|
|
357
358
|
return x !== y;
|
|
358
359
|
});
|
|
359
360
|
var isNot = notEquals;
|
|
360
|
-
var notEqualsDeep = complement(equals);
|
|
361
|
+
var notEqualsDeep = /*#__PURE__*/complement(equals);
|
|
361
362
|
var isNotEqualDeep = notEqualsDeep;
|
|
362
363
|
|
|
363
364
|
export { camelToSnakeCase, capitalize, copyKeys, copyKeysDeep, countBy, deepFreezeObject, dynamicArray, existsBy, existsById, filterBy, filterNonNull, findBy, findById, findIndexBy, findIndexById, findLastBy, findLastIndexBy, getRandomInt, humanize, isNot, isNotEmpty, isNotEqualDeep, isNotNil, keysToCamelCase, keysToSnakeCase, matches, modifyBy, modifyById, noop, notEquals, notEqualsDeep, randomPick, removeBy, removeById, renameKeys, replaceBy, replaceById, serializeKeysToSnakeCase, slugify, snakeToCamelCase, toLabelAndValue, transformObjectDeep, truncate };
|
package/utils.cjs.js
CHANGED
|
@@ -545,12 +545,6 @@ var getRandomInt = function getRandomInt() {
|
|
|
545
545
|
|
|
546
546
|
return Math.floor(Math.random() * (b - a) + a);
|
|
547
547
|
};
|
|
548
|
-
ramda.complement(ramda.isNil);
|
|
549
|
-
ramda.complement(ramda.isEmpty);
|
|
550
|
-
ramda.curry(function (x, y) {
|
|
551
|
-
return x !== y;
|
|
552
|
-
});
|
|
553
|
-
ramda.complement(ramda.equals);
|
|
554
548
|
|
|
555
549
|
var queryString = {};
|
|
556
550
|
|
|
@@ -1175,7 +1169,7 @@ var filterObj = function (obj, predicate) {
|
|
|
1175
1169
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1176
1170
|
|
|
1177
1171
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1178
|
-
var withEventTargetValue = ramda.curry(function (func, event) {
|
|
1172
|
+
var withEventTargetValue = /*#__PURE__*/ramda.curry(function (func, event) {
|
|
1179
1173
|
return func(event.target.value);
|
|
1180
1174
|
});
|
|
1181
1175
|
var getSubdomain = function getSubdomain() {
|
package/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import { values,
|
|
2
|
+
import { values, curry, toPairs, omit, isEmpty } from 'ramda';
|
|
3
3
|
import i18next from 'i18next';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
@@ -533,12 +533,6 @@ var getRandomInt = function getRandomInt() {
|
|
|
533
533
|
|
|
534
534
|
return Math.floor(Math.random() * (b - a) + a);
|
|
535
535
|
};
|
|
536
|
-
complement(isNil);
|
|
537
|
-
complement(isEmpty);
|
|
538
|
-
curry(function (x, y) {
|
|
539
|
-
return x !== y;
|
|
540
|
-
});
|
|
541
|
-
complement(equals);
|
|
542
536
|
|
|
543
537
|
var queryString = {};
|
|
544
538
|
|
|
@@ -1163,7 +1157,7 @@ var filterObj = function (obj, predicate) {
|
|
|
1163
1157
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1164
1158
|
|
|
1165
1159
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1166
|
-
var withEventTargetValue = curry(function (func, event) {
|
|
1160
|
+
var withEventTargetValue = /*#__PURE__*/curry(function (func, event) {
|
|
1167
1161
|
return func(event.target.value);
|
|
1168
1162
|
});
|
|
1169
1163
|
var getSubdomain = function getSubdomain() {
|