@wise-old-man/utils 3.1.15 → 3.1.17

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.
@@ -1,15 +1,8 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
3
  var dayjs = require('dayjs');
6
4
  var customParseFormatPlugin = require('dayjs/plugin/customParseFormat');
7
5
 
8
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
-
10
- var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
11
- var customParseFormatPlugin__default = /*#__PURE__*/_interopDefaultLegacy(customParseFormatPlugin);
12
-
13
6
  var config = {
14
7
  defaultUserAgent: `WiseOldMan JS Client v${process.env.npm_package_version}`,
15
8
  baseAPIUrl: 'https://api.wiseoldman.net/v2'
@@ -29,6 +22,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
29
22
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
30
23
  PERFORMANCE OF THIS SOFTWARE.
31
24
  ***************************************************************************** */
25
+ /* global Reflect, Promise */
26
+
32
27
 
33
28
  function __rest(s, e) {
34
29
  var t = {};
@@ -52,7 +47,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
52
47
  });
53
48
  }
54
49
 
55
- dayjs__default["default"].extend(customParseFormatPlugin__default["default"]);
50
+ dayjs.extend(customParseFormatPlugin);
56
51
  function traverseTransform(input, transformation) {
57
52
  if (Array.isArray(input)) {
58
53
  return input.map(item => traverseTransform(item, transformation));
@@ -67,7 +62,7 @@ function isValidISODate(input) {
67
62
  return false;
68
63
  // DayJS has a bug with strict parsing with timezones https://github.com/iamkun/dayjs/issues/929
69
64
  // So I'll just strip the "Z" timezone
70
- return input.endsWith('Z') && dayjs__default["default"](input.slice(0, -1), 'YYYY-MM-DDTHH:mm:ss.SSS', true).isValid();
65
+ return input.endsWith('Z') && dayjs(input.slice(0, -1), 'YYYY-MM-DDTHH:mm:ss.SSS', true).isValid();
71
66
  }
72
67
  function transformDates(input) {
73
68
  return traverseTransform(input, val => (isValidISODate(val) ? new Date(val) : val));
@@ -1562,7 +1557,8 @@ function getCombatLevel(attack, strength, defence, ranged, magic, hitpoints, pra
1562
1557
 
1563
1558
  function mapValues(obj, callback) {
1564
1559
  const clone = {};
1565
- Object.keys(obj).forEach(key => {
1560
+ Object.keys(obj).forEach(k => {
1561
+ const key = k;
1566
1562
  clone[key] = callback(obj[key], key, obj);
1567
1563
  });
1568
1564
  return clone;