@shakerquiz/utilities 0.3.4 → 0.3.6

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": "@shakerquiz/utilities",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "author": "yurkimus <yurkimus@gmail.com>",
5
5
  "license": "ISC",
6
6
  "exports": {
@@ -74,52 +74,52 @@ export var useFetch = (service, feature, network) =>
74
74
  function fetcher(options, init) {
75
75
  if (!(service in Services))
76
76
  throw TypeError(
77
- `Feature '${service}' must be listed in 'Features'.`,
77
+ `Service '${service}' is not listed in 'Services'.`,
78
78
  )
79
79
 
80
80
  if (!(feature in Features))
81
81
  throw TypeError(
82
- `Feature '${feature}' must be listed in 'Features'.`,
82
+ `Feature '${feature}' is not listed in 'Features'.`,
83
83
  )
84
84
 
85
85
  if (!(feature in FeaturePathnames))
86
86
  throw TypeError(
87
- `Feature '${feature}' must be listed in 'FeaturePathnames'.`,
87
+ `Feature '${feature}' is not listed in 'FeaturePathnames'.`,
88
88
  )
89
89
 
90
- if (!(feature in ServiceFeatures[service]))
90
+ if (!ServiceFeatures[service].includes(feature))
91
91
  throw TypeError(
92
- `Feature '${feature}' must be listed in 'ServiceFeatures'.`,
92
+ `Feature '${feature}' is not listed in 'ServiceFeatures[${service}]'.`,
93
93
  )
94
94
 
95
95
  if (!(init.method in RequestMethods))
96
96
  throw TypeError(
97
- `Method '${init.method}' must be listed in 'RequestMethods'.`,
97
+ `Method '${init.method}' is not listed in 'RequestMethods'.`,
98
98
  )
99
99
 
100
100
  if (!(network in Networks))
101
101
  throw TypeError(
102
- `Network '${network}' must be listed in 'Networks'.`,
102
+ `Network '${network}' is not listed in 'Networks'.`,
103
103
  )
104
104
 
105
105
  if (!ServiceFeatureNetworkURLs.has(service))
106
106
  throw TypeError(
107
- `Service '${service}' must be listed in 'ServiceFeatureNetworkURLs'.`,
107
+ `Service '${service}' is not listed in 'ServiceFeatureNetworkURLs'.`,
108
108
  )
109
109
 
110
110
  if (!ServiceFeatureNetworkURLs.get(service).has(feature))
111
111
  throw TypeError(
112
- `Feature '${feature}' must be listed in 'ServiceFeatureNetworkURLs[${service}]'.`,
112
+ `Feature '${feature}' is not listed in 'ServiceFeatureNetworkURLs[${service}]'.`,
113
113
  )
114
114
 
115
115
  if (!ServiceFeatureNetworkURLs.get(service).get(feature).has(network))
116
116
  throw TypeError(
117
- `Network '${network}' must be listed in 'ServiceFeatureNetworkURLs[${service}][${feature}]'.`,
117
+ `Network '${network}' is not listed in 'ServiceFeatureNetworkURLs[${service}][${feature}]'.`,
118
118
  )
119
119
 
120
120
  if (!ServiceFeatureNetworkURLs.get(service).get(feature).get(network))
121
121
  throw TypeError(
122
- `Network '${network}' of 'ServiceFeatureNetworkURLs[${service}][${feature}]' must have a value.`,
122
+ `Network '${network}' of 'ServiceFeatureNetworkURLs[${service}][${feature}]' has no value.`,
123
123
  )
124
124
 
125
125
  extensions.set(
@@ -28,40 +28,40 @@ export var setServiceNetworkOrigins = origins => {
28
28
  `Network '${network}' must be listed in 'Networks'.`,
29
29
  )
30
30
 
31
- for (var origin in origins[service][network]) {
32
- ServiceNetworkOrigins
33
- .get(service)
34
- .set(network, origin)
31
+ var origin = origins[service][network]
32
+
33
+ ServiceNetworkOrigins
34
+ .get(service)
35
+ .set(network, origin)
35
36
 
36
- for (var feature of ServiceFeatures[service]) {
37
- if (!(feature in Features))
38
- throw TypeError(
39
- `Feature '${feature}' must be listed in 'Features'.`,
40
- )
37
+ for (var feature of ServiceFeatures[service]) {
38
+ if (!(feature in Features))
39
+ throw TypeError(
40
+ `Feature '${feature}' must be listed in 'Features'.`,
41
+ )
41
42
 
42
- if (!(feature in FeaturePathnames))
43
- throw TypeError(
44
- `Feature '${feature}' must be listed in 'FeaturePathnames'.`,
45
- )
43
+ if (!(feature in FeaturePathnames))
44
+ throw TypeError(
45
+ `Feature '${feature}' must be listed in 'FeaturePathnames'.`,
46
+ )
46
47
 
47
- if (!ServiceFeatureNetworkURLs.has(service))
48
- throw TypeError(
49
- `Service '${service}' must be listed in 'ServiceFeatureNetworkURLs'.`,
50
- )
48
+ if (!ServiceFeatureNetworkURLs.has(service))
49
+ throw TypeError(
50
+ `Service '${service}' must be listed in 'ServiceFeatureNetworkURLs'.`,
51
+ )
51
52
 
52
- if (!ServiceFeatureNetworkURLs.get(service).has(feature))
53
- throw TypeError(
54
- `Feature '${feature}' must be listed in 'ServiceFeatureNetworkURLs[${service}]'.`,
55
- )
53
+ if (!ServiceFeatureNetworkURLs.get(service).has(feature))
54
+ throw TypeError(
55
+ `Feature '${feature}' must be listed in 'ServiceFeatureNetworkURLs[${service}]'.`,
56
+ )
56
57
 
57
- ServiceFeatureNetworkURLs
58
- .get(service)
59
- .get(feature)
60
- .set(
61
- network,
62
- url.bind(undefined, origin, FeaturePathnames[feature]),
63
- )
64
- }
58
+ ServiceFeatureNetworkURLs
59
+ .get(service)
60
+ .get(feature)
61
+ .set(
62
+ network,
63
+ url.bind(undefined, origin, FeaturePathnames[feature]),
64
+ )
65
65
  }
66
66
  }
67
67
  }