@wise-old-man/utils 3.3.9 → 3.3.11

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,8 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var dayjs = require('dayjs');
4
- var customParseFormatPlugin = require('dayjs/plugin/customParseFormat.js');
5
-
6
3
  var config = {
7
4
  defaultUserAgent: `WiseOldMan JS Client v${process.env.npm_package_version}`,
8
5
  baseAPIUrl: 'https://api.wiseoldman.net/v2'
@@ -47,7 +44,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
47
44
  });
48
45
  }
49
46
 
50
- dayjs.extend(customParseFormatPlugin);
51
47
  function traverseTransform(input, transformation) {
52
48
  if (Array.isArray(input)) {
53
49
  return input.map(item => traverseTransform(item, transformation));
@@ -60,9 +56,8 @@ function traverseTransform(input, transformation) {
60
56
  function isValidISODate(input) {
61
57
  if (!input || typeof input !== 'string')
62
58
  return false;
63
- // DayJS has a bug with strict parsing with timezones https://github.com/iamkun/dayjs/issues/929
64
- // So I'll just strip the "Z" timezone
65
- return input.endsWith('Z') && dayjs(input.slice(0, -1), 'YYYY-MM-DDTHH:mm:ss.SSS', true).isValid();
59
+ // Validate this input string is a ISO 8601 date
60
+ return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(input);
66
61
  }
67
62
  function transformDates(input) {
68
63
  return traverseTransform(input, val => (isValidISODate(val) ? new Date(val) : val));
@@ -619,6 +614,7 @@ const Boss = {
619
614
  VETION: 'vetion',
620
615
  VORKATH: 'vorkath',
621
616
  WINTERTODT: 'wintertodt',
617
+ YAMA: 'yama',
622
618
  ZALCANO: 'zalcano',
623
619
  ZULRAH: 'zulrah'
624
620
  };
@@ -1971,6 +1967,7 @@ const BossProps = mapValues({
1971
1967
  [Boss.VETION]: { name: "Vet'ion" },
1972
1968
  [Boss.VORKATH]: { name: 'Vorkath' },
1973
1969
  [Boss.WINTERTODT]: { name: 'Wintertodt' },
1970
+ [Boss.YAMA]: { name: 'Yama' },
1974
1971
  [Boss.ZALCANO]: { name: 'Zalcano' },
1975
1972
  [Boss.ZULRAH]: { name: 'Zulrah' }
1976
1973
  }, props => (Object.assign(Object.assign({}, props), { type: exports.MetricType.BOSS, measure: exports.MetricMeasure.KILLS, isMembers: 'isMembers' in props ? props.isMembers : true, minimumValue: 'minimumValue' in props ? props.minimumValue : 5 })));
package/dist/es/index.js CHANGED
@@ -1,6 +1,3 @@
1
- import dayjs from 'dayjs';
2
- import customParseFormatPlugin from 'dayjs/plugin/customParseFormat.js';
3
-
4
1
  var config = {
5
2
  defaultUserAgent: `WiseOldMan JS Client v${process.env.npm_package_version}`,
6
3
  baseAPIUrl: 'https://api.wiseoldman.net/v2'
@@ -45,7 +42,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
45
42
  });
46
43
  }
47
44
 
48
- dayjs.extend(customParseFormatPlugin);
49
45
  function traverseTransform(input, transformation) {
50
46
  if (Array.isArray(input)) {
51
47
  return input.map(item => traverseTransform(item, transformation));
@@ -58,9 +54,8 @@ function traverseTransform(input, transformation) {
58
54
  function isValidISODate(input) {
59
55
  if (!input || typeof input !== 'string')
60
56
  return false;
61
- // DayJS has a bug with strict parsing with timezones https://github.com/iamkun/dayjs/issues/929
62
- // So I'll just strip the "Z" timezone
63
- return input.endsWith('Z') && dayjs(input.slice(0, -1), 'YYYY-MM-DDTHH:mm:ss.SSS', true).isValid();
57
+ // Validate this input string is a ISO 8601 date
58
+ return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(input);
64
59
  }
65
60
  function transformDates(input) {
66
61
  return traverseTransform(input, val => (isValidISODate(val) ? new Date(val) : val));
@@ -617,6 +612,7 @@ const Boss = {
617
612
  VETION: 'vetion',
618
613
  VORKATH: 'vorkath',
619
614
  WINTERTODT: 'wintertodt',
615
+ YAMA: 'yama',
620
616
  ZALCANO: 'zalcano',
621
617
  ZULRAH: 'zulrah'
622
618
  };
@@ -1969,6 +1965,7 @@ const BossProps = mapValues({
1969
1965
  [Boss.VETION]: { name: "Vet'ion" },
1970
1966
  [Boss.VORKATH]: { name: 'Vorkath' },
1971
1967
  [Boss.WINTERTODT]: { name: 'Wintertodt' },
1968
+ [Boss.YAMA]: { name: 'Yama' },
1972
1969
  [Boss.ZALCANO]: { name: 'Zalcano' },
1973
1970
  [Boss.ZULRAH]: { name: 'Zulrah' }
1974
1971
  }, props => (Object.assign(Object.assign({}, props), { type: MetricType.BOSS, measure: MetricMeasure.KILLS, isMembers: 'isMembers' in props ? props.isMembers : true, minimumValue: 'minimumValue' in props ? props.minimumValue : 5 })));
package/dist/es/index.mjs CHANGED
@@ -1,6 +1,3 @@
1
- import dayjs from 'dayjs';
2
- import customParseFormatPlugin from 'dayjs/plugin/customParseFormat.js';
3
-
4
1
  var config = {
5
2
  defaultUserAgent: `WiseOldMan JS Client v${process.env.npm_package_version}`,
6
3
  baseAPIUrl: 'https://api.wiseoldman.net/v2'
@@ -45,7 +42,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
45
42
  });
46
43
  }
47
44
 
48
- dayjs.extend(customParseFormatPlugin);
49
45
  function traverseTransform(input, transformation) {
50
46
  if (Array.isArray(input)) {
51
47
  return input.map(item => traverseTransform(item, transformation));
@@ -58,9 +54,8 @@ function traverseTransform(input, transformation) {
58
54
  function isValidISODate(input) {
59
55
  if (!input || typeof input !== 'string')
60
56
  return false;
61
- // DayJS has a bug with strict parsing with timezones https://github.com/iamkun/dayjs/issues/929
62
- // So I'll just strip the "Z" timezone
63
- return input.endsWith('Z') && dayjs(input.slice(0, -1), 'YYYY-MM-DDTHH:mm:ss.SSS', true).isValid();
57
+ // Validate this input string is a ISO 8601 date
58
+ return /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(input);
64
59
  }
65
60
  function transformDates(input) {
66
61
  return traverseTransform(input, val => (isValidISODate(val) ? new Date(val) : val));
@@ -617,6 +612,7 @@ const Boss = {
617
612
  VETION: 'vetion',
618
613
  VORKATH: 'vorkath',
619
614
  WINTERTODT: 'wintertodt',
615
+ YAMA: 'yama',
620
616
  ZALCANO: 'zalcano',
621
617
  ZULRAH: 'zulrah'
622
618
  };
@@ -1969,6 +1965,7 @@ const BossProps = mapValues({
1969
1965
  [Boss.VETION]: { name: "Vet'ion" },
1970
1966
  [Boss.VORKATH]: { name: 'Vorkath' },
1971
1967
  [Boss.WINTERTODT]: { name: 'Wintertodt' },
1968
+ [Boss.YAMA]: { name: 'Yama' },
1972
1969
  [Boss.ZALCANO]: { name: 'Zalcano' },
1973
1970
  [Boss.ZULRAH]: { name: 'Zulrah' }
1974
1971
  }, props => (Object.assign(Object.assign({}, props), { type: MetricType.BOSS, measure: MetricMeasure.KILLS, isMembers: 'isMembers' in props ? props.isMembers : true, minimumValue: 'minimumValue' in props ? props.minimumValue : 5 })));
package/dist/index.d.ts CHANGED
@@ -497,6 +497,7 @@ declare const Boss: {
497
497
  readonly VETION: "vetion";
498
498
  readonly VORKATH: "vorkath";
499
499
  readonly WINTERTODT: "wintertodt";
500
+ readonly YAMA: "yama";
500
501
  readonly ZALCANO: "zalcano";
501
502
  readonly ZULRAH: "zulrah";
502
503
  };
@@ -572,6 +573,7 @@ declare const Metric: {
572
573
  readonly VETION: "vetion";
573
574
  readonly VORKATH: "vorkath";
574
575
  readonly WINTERTODT: "wintertodt";
576
+ readonly YAMA: "yama";
575
577
  readonly ZALCANO: "zalcano";
576
578
  readonly ZULRAH: "zulrah";
577
579
  readonly LEAGUE_POINTS: "league_points";
@@ -1733,6 +1735,7 @@ declare const MetricProps: {
1733
1735
  readonly vetion: BossProperties;
1734
1736
  readonly vorkath: BossProperties;
1735
1737
  readonly wintertodt: BossProperties;
1738
+ readonly yama: BossProperties;
1736
1739
  readonly zalcano: BossProperties;
1737
1740
  readonly zulrah: BossProperties;
1738
1741
  readonly overall: SkillProperties;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise-old-man/utils",
3
- "version": "3.3.9",
3
+ "version": "3.3.11",
4
4
  "description": "A JavaScript/TypeScript client that interfaces and consumes the Wise Old Man API, an API that tracks and measures players' progress in Old School Runescape.",
5
5
  "keywords": [
6
6
  "wiseoldman",
@@ -51,7 +51,5 @@
51
51
  "tslib": "^2.4.0",
52
52
  "typescript": "^5.3.3"
53
53
  },
54
- "dependencies": {
55
- "dayjs": "^1.11.5"
56
- }
54
+ "dependencies": {}
57
55
  }