@juice789/tf2items 1.0.38 → 2.0.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/sku.js CHANGED
@@ -1,23 +1,10 @@
1
- const {
2
- compose, split, map, reduce, pickBy, mergeRight, converge, concat, join, head, tail, filter
3
- } = require('ramda')
1
+ import { safeItems } from './schemaItems.js'
2
+ import schemaHelper from './schemaHelper.json' with { type: 'json' }
3
+ import schema from './schema.json' with { type: 'json' }
4
+ const { qualityNames, killstreakTiers, wears } = schemaHelper
5
+ const { textures, particleEffects } = schema
4
6
 
5
- const {
6
- safeItems
7
- } = require('./schemaItems.js')
8
-
9
- const {
10
- qualityNames,
11
- killstreakTiers,
12
- wears
13
- } = require('./schemaHelper.json')
14
-
15
- const {
16
- textures,
17
- particleEffects
18
- } = require('./schema.json')
19
-
20
- const skuFromItem = ({
7
+ export const skuFromItem = ({
21
8
  defindex,
22
9
  quality,
23
10
  uncraftable,
@@ -34,9 +21,10 @@ const skuFromItem = ({
34
21
  series,
35
22
  craft,
36
23
  paintColor,
37
- halloweenSpell
24
+ halloweenSpell,
25
+ rch
38
26
  }) => [
39
- defindex,
27
+ (defindex === '0000' || (rch && !craft && !halloweenSpell)) ? '0000' : defindex,
40
28
  quality,
41
29
  ['1', true].includes(uncraftable) && 'uncraftable',
42
30
  ['1', true].includes(elevated) && 'strange',
@@ -52,7 +40,8 @@ const skuFromItem = ({
52
40
  series && isNaN(series) === false && 'c-' + parseInt(series),
53
41
  craft && isNaN(craft) === false && 'no-' + parseInt(craft),
54
42
  paintColor && 'pc-' + paintColor,
55
- halloweenSpell && 'hs-' + halloweenSpell
43
+ halloweenSpell && 'hs-' + halloweenSpell,
44
+ (rch && !craft && !halloweenSpell) && 'rch-' + rch
56
45
  ].filter(Boolean).join(';')
57
46
 
58
47
  const rules = {
@@ -70,22 +59,23 @@ const rules = {
70
59
  c: "series",
71
60
  no: "craft",
72
61
  pc: "paintColor",
73
- hs: "halloweenSpell"
62
+ hs: "halloweenSpell",
63
+ rch: "rch"
74
64
  }
75
65
 
76
- const decodeRules = compose(
77
- pickBy((v, k) => k !== 'undefined'),
78
- reduce(mergeRight, {}),
79
- map(
80
- compose(
81
- ([k, value = true]) => ({ [rules[k]]: value }),
82
- converge(concat, [compose(Array.of, head), compose(filter(Boolean), Array.of, join('-'), tail)]),
83
- split('-')
84
- )
85
- )
86
- )
66
+ function decodeRules(parts) {
67
+ const result = {}
68
+ for (const part of parts) {
69
+ const dash = part.indexOf('-')
70
+ const k = dash === -1 ? part : part.slice(0, dash)
71
+ const value = dash === -1 ? true : part.slice(dash + 1)
72
+ const prop = rules[k]
73
+ if (prop !== undefined) result[prop] = value
74
+ }
75
+ return result
76
+ }
87
77
 
88
- const itemFromSku = (sku) => {
78
+ export const itemFromSku = (sku) => {
89
79
  const [defindex, quality, ...more] = sku.split(';')
90
80
  const item = {
91
81
  defindex,
@@ -93,10 +83,13 @@ const itemFromSku = (sku) => {
93
83
  ...decodeRules(more)
94
84
  }
95
85
  item.sku = sku
86
+ if(item.defindex === '0000' && item.rch){
87
+ item.defindex = item.rch
88
+ }
96
89
  return item
97
90
  }
98
91
 
99
- const getName = ({
92
+ export const getName = ({
100
93
  defindex,
101
94
  quality,
102
95
  uncraftable,
@@ -111,7 +104,8 @@ const getName = ({
111
104
  wear,
112
105
  australium,
113
106
  series,
114
- craft
107
+ craft,
108
+ rch
115
109
  },
116
110
  bpTexture = false,
117
111
  qualityBpStyle = false,
@@ -133,20 +127,13 @@ const getName = ({
133
127
  bpTexture && '|',
134
128
  australium && 'Australium',
135
129
  useProperName && safeItems[defindex].propername === '1' && quality.toString() === '6' && !uncraftable && !elevated && !festivized && !killstreakTier && 'The',
136
- safeItems[defindex].item_name,
130
+ defindex === '0000' && !rch ? 'Random Craft Hat' : safeItems[rch || defindex].item_name,
137
131
  wear && '(' + wears[wear] + ')',
138
132
  series && '#' + series
139
133
  ].filter(Boolean).join(' ').replace('\\n', `
140
134
  `)
141
135
 
142
- const itemNameFromSku = (sku, ...params) => {
136
+ export const itemNameFromSku = (sku, ...params) => {
143
137
  const item = itemFromSku(sku)
144
138
  return getName(item, ...params)
145
139
  }
146
-
147
- module.exports = {
148
- skuFromItem,
149
- itemFromSku,
150
- getName,
151
- itemNameFromSku
152
- }
package/sku753.js CHANGED
@@ -1,28 +1,23 @@
1
- const skuFromItem753 = ({
1
+ export const skuFromItem753 = ({
2
2
  market_hash_name,
3
3
  game,
4
4
  border,
5
5
  type,
6
6
  }) => [
7
7
  753,
8
- type === '2' ? `${type}-${border}` : type,
8
+ (type === '2' && border) ? `${type}-${border}` : type,
9
9
  game,
10
10
  encodeURIComponent(market_hash_name)
11
11
  ].filter(Boolean).join(';')
12
12
 
13
- const itemFromSku753 = (sku) => {
13
+ export const itemFromSku753 = (sku) => {
14
14
  const [x, type, game, market_hash_name] = sku.split(';')
15
15
  const item = {
16
- type,
17
- border: type[1],
16
+ type: type[0],
17
+ border: type[2],
18
18
  game,
19
19
  market_hash_name: decodeURIComponent(market_hash_name)
20
20
  }
21
21
  item.sku = sku
22
22
  return item
23
23
  }
24
-
25
- module.exports = {
26
- skuFromItem753,
27
- itemFromSku753
28
- }
package/skuBp.js CHANGED
@@ -1,10 +1,10 @@
1
- const crypto = require('crypto')
2
- const { safeItems: items } = require('./schemaItems.js')
3
- const { qualityNames } = require('./schemaHelper.json')
4
- const { itemFromSku, getName } = require('./sku.js')
5
- const { omit } = require('ramda')
1
+ import { createHash } from 'node:crypto'
2
+ import { safeItems as items } from './schemaItems.js'
3
+ import schemaHelper from './schemaHelper.json' with { type: 'json' }
4
+ const { qualityNames } = schemaHelper
5
+ import { itemFromSku, getName } from './sku.js'
6
6
 
7
- const toBpQuality = (sku) => {
7
+ export const toBpQuality = (sku) => {
8
8
 
9
9
  const {
10
10
  defindex,
@@ -26,17 +26,14 @@ const toBpQuality = (sku) => {
26
26
  ].filter(Boolean).join(' ')
27
27
  }
28
28
 
29
- const toBpName = (sku) => {
29
+ export const toBpName = (sku) => {
30
30
 
31
- const item = omit(
32
- ['quality', 'elevated', 'uncraftable', 'craft', 'target', 'output', 'oq', 'effect', 'series'],
33
- itemFromSku(sku)
34
- )
31
+ const { quality, elevated, uncraftable, craft, target, output, oq, effect, series, ...item } = itemFromSku(sku)
35
32
 
36
33
  return getName(item, Boolean(item.texture))
37
34
  }
38
35
 
39
- const toBpPriceIndex = (sku) => {
36
+ export const toBpPriceIndex = (sku) => {
40
37
 
41
38
  const {
42
39
  effect,
@@ -57,7 +54,7 @@ const toBpPriceIndex = (sku) => {
57
54
  ].filter(Boolean).join('/')
58
55
  }
59
56
 
60
- const listingV1FromSku = (sku) => {
57
+ export const listingV1FromSku = (sku) => {
61
58
  const { uncraftable } = itemFromSku(sku)
62
59
  return {
63
60
  quality: toBpQuality(sku),
@@ -67,7 +64,7 @@ const listingV1FromSku = (sku) => {
67
64
  }
68
65
  }
69
66
 
70
- const listingV2ResolvableFromSku = (sku) => {
67
+ export const listingV2ResolvableFromSku = (sku) => {
71
68
  const { uncraftable } = itemFromSku(sku)
72
69
  return {
73
70
  quality: toBpQuality(sku),
@@ -78,22 +75,9 @@ const listingV2ResolvableFromSku = (sku) => {
78
75
  }
79
76
  }
80
77
 
81
- const toBpSku = (sku) => {
82
- const item = omit(
83
- ['craft'],
84
- itemFromSku(sku)
85
- )
78
+ export const toBpSku = (sku) => {
79
+ const { craft, ...item } = itemFromSku(sku)
86
80
  return getName(item, null, Boolean(item.effect), true)
87
81
  }
88
82
 
89
- const toBpId = (sku) => crypto.createHash('md5').update(toBpSku(sku)).digest('hex')
90
-
91
- module.exports = {
92
- toBpQuality,
93
- toBpName,
94
- toBpId,
95
- toBpPriceIndex,
96
- listingV1FromSku,
97
- listingV2ResolvableFromSku,
98
- toBpSku
99
- }
83
+ export const toBpId = (sku) => createHash('md5').update(toBpSku(sku)).digest('hex')
package/skuLinks.js CHANGED
@@ -1,32 +1,13 @@
1
+ import removeAccents from 'remove-accents'
2
+ import { itemFromSku } from './sku.js'
3
+ import { toBpQuality, toBpName, toBpPriceIndex } from './skuBp.js'
4
+ import schemaHelper from './schemaHelper.json' with { type: 'json' }
5
+ import schema from './schema.json' with { type: 'json' }
6
+ import { safeItems as items } from './schemaItems.js'
7
+ const { qualityNames, killstreakTiers, wears } = schemaHelper
8
+ const { particleEffects, textures } = schema
1
9
 
2
- const removeAccents = require('remove-accents');
3
-
4
- const {
5
- itemFromSku
6
- } = require('./sku.js')
7
-
8
- const {
9
- toBpQuality,
10
- toBpName,
11
- toBpPriceIndex
12
- } = require('./skuBp.js')
13
-
14
- const {
15
- qualityNames,
16
- killstreakTiers,
17
- wears
18
- } = require('./schemaHelper.json')
19
-
20
- const {
21
- safeItems: items
22
- } = require('./schemaItems.js')
23
-
24
- const {
25
- particleEffects,
26
- textures
27
- } = require('./schema.json')
28
-
29
- const marketHashNameFromSku = (sku) => {
10
+ export const marketHashNameFromSku = (sku) => {
30
11
 
31
12
  const {
32
13
  defindex,
@@ -69,7 +50,7 @@ const marketHashNameFromSku = (sku) => {
69
50
  return marketHashName
70
51
  }
71
52
 
72
- const manncoUrl = (sku) => {
53
+ export const manncoUrl = (sku) => {
73
54
  const {
74
55
  defindex,
75
56
  quality,
@@ -84,7 +65,8 @@ const manncoUrl = (sku) => {
84
65
  wear,
85
66
  australium,
86
67
  series,
87
- effect
68
+ effect,
69
+ rch
88
70
  } = itemFromSku(sku)
89
71
 
90
72
 
@@ -107,7 +89,7 @@ const manncoUrl = (sku) => {
107
89
  target && items[target].item_name,
108
90
  output && items[output].item_name,
109
91
  items[defindex].propername === '1' && quality.toString() === '6' && !elevated && !festivized && !killstreakTier && 'The',
110
- items[defindex].item_name.replace('\\n', ' '),
92
+ defindex === '0000' ? (rch ? items[rch].item_name.replace('\\n', ' ') : 'random craft hat') : items[defindex].item_name.replace('\\n', ' '),
111
93
  wear && wears[wear],
112
94
  chemSeries[defindex] && 'series-' + chemSeries[defindex],
113
95
  series && (!items[defindex].seriesHidden || ['111', '112', '113', '114', '115', '116'].includes(series)) && 'series-' + series
@@ -116,12 +98,14 @@ const manncoUrl = (sku) => {
116
98
  return 'https://mannco.store/item/' + url
117
99
  }
118
100
 
119
- const scmUrl = (sku) => {
101
+ export const scmUrl = (sku) => {
120
102
  const marketHashName = marketHashNameFromSku(sku)
121
- return 'https://steamcommunity.com/market/listings/440/' + encodeURIComponent(marketHashName)
103
+ return marketHashName.includes('Undefined item')
104
+ ? '#' + encodeURIComponent(marketHashName)
105
+ : 'https://steamcommunity.com/market/listings/440/' + encodeURIComponent(marketHashName)
122
106
  }
123
107
 
124
- const bpUrl = (sku) => {
108
+ export const bpUrl = (sku) => {
125
109
 
126
110
  const {
127
111
  uncraftable
@@ -138,7 +122,7 @@ const bpUrl = (sku) => {
138
122
  return 'https://backpack.tf/stats/' + bpUrl
139
123
  }
140
124
 
141
- const marketplaceUrl = (sku) => {
125
+ export const marketplaceUrl = (sku) => {
142
126
  const {
143
127
  defindex,
144
128
  quality,
@@ -154,12 +138,13 @@ const marketplaceUrl = (sku) => {
154
138
  australium,
155
139
  series,
156
140
  craft,
157
- effect
141
+ effect,
142
+ rch
158
143
  } = itemFromSku(sku)
159
144
 
160
145
 
161
146
  const marketplaceSku = [
162
- defindex,
147
+ defindex === '0000' ? (rch || '-100') : defindex,
163
148
  quality,
164
149
  effect && 'u' + effect,
165
150
  wear && 'w' + wear,
@@ -178,11 +163,3 @@ const marketplaceUrl = (sku) => {
178
163
 
179
164
  return 'https://marketplace.tf/items/tf2/' + marketplaceSku
180
165
  }
181
-
182
- module.exports = {
183
- manncoUrl,
184
- marketplaceUrl,
185
- bpUrl,
186
- scmUrl,
187
- marketHashNameFromSku
188
- }
package/transformItems.js CHANGED
@@ -1,5 +1,6 @@
1
- const { prop, pick, map, compose, complement, includes, equals, length, allPass, mapObjIndexed, when, has, __, chain, assoc, pathEq, omit, split, keys, propEq, propOr, nth, range, path, uncurryN, mergeDeepRight, reduce, concat } = require('ramda')
2
- const { qualityIds, strangifierTargets, crateSeries, chemsetDefindex } = require('./schemaHelper.json')
1
+ import { mergeDeepRight } from './utils.js'
2
+ import schemaHelper from './schemaHelper.json' with { type: 'json' }
3
+ const { qualityIds, strangifierTargets, crateSeries, chemsetDefindex } = schemaHelper
3
4
 
4
5
  const propsToKeep = [
5
6
  'name',
@@ -19,88 +20,59 @@ const propsToKeep = [
19
20
  'item_quality'
20
21
  ]
21
22
 
22
- const transformItems = uncurryN(3, (collections, itemsApi) => compose(
23
- map((item) => mergeDeepRight(collections[item.name], item)),
24
- reduce(mergeDeepRight, {}),
25
- concat([itemsApi, crateSeries, strangifierTargets, chemsetDefindex]),
26
- Array.of,
27
- map(
28
- compose(
29
- pick(propsToKeep),
30
- when(
31
- allPass([
32
- compose(Boolean, prop('item_slot')),
33
- compose(includes(__, ['primary', 'melee', 'secondary', 'pda', 'pda2', 'building']), prop('item_slot')),
34
- compose(
35
- includes(__, range(2, 9)),
36
- length,
37
- prop('used_by_classes')
38
- )
39
- ]),
40
- assoc('used_by_classes', ['multi'])
41
- ),
42
- when(
43
- allPass([
44
- compose(Boolean, prop('item_slot')),
45
- compose(equals(9), length, prop('used_by_classes'))
46
- ]),
47
- assoc('used_by_classes', ['all'])
48
- ),
49
- when(
50
- has('used_by_classes'),
51
- chain(assoc('used_by_classes'), compose(keys, prop('used_by_classes')))
52
- ),
53
- when(
54
- compose(complement(Boolean), prop('item_name')),
55
- chain(assoc('item_name'), prop('name'))
56
- ),
57
- when(
58
- path(['static_attrs', 'tool target item']),
59
- chain(assoc('target'), compose(Array.of, path(['static_attrs', 'tool target item'])))
60
- ),
61
- when(
62
- path(['static_attrs', 'hide crate series number']),
63
- assoc('seriesHidden', true)
64
- ),
65
- when(
66
- path(['static_attrs', 'set supply crate series']),
67
- chain(assoc('series'), compose(Array.of, path(['static_attrs', 'set supply crate series'])))
68
- ),
69
- when(
70
- path(['attributes', 'tool target item', 'value']),
71
- chain(assoc('target'), compose(Array.of, path(['attributes', 'tool target item', 'value'])))
72
- ),
73
- when(
74
- pathEq('1', ['tags', 'can_be_festivized']),
75
- assoc('festivized', '1')
76
- ),
77
- when(
78
- pathEq('1', ['attributes', 'cannot trade', 'value']),
79
- assoc('untradable', '1')
80
- ),
81
- when(
82
- pathEq('paint_can', ['tool', 'type']),
83
- assoc('type2', 'paint')
84
- ),
85
- when(
86
- pathEq('decoder_ring', ['tool', 'type']),
87
- assoc('type2', 'key')
88
- ),
89
- when(
90
- has('item_quality'),
91
- chain(assoc('item_quality'), compose(prop(__, qualityIds), nth(0), split(' '), prop('item_quality')))
92
- ),
93
- when(
94
- allPass([
95
- compose(includes('paintkitweapon'), propOr('', 'item_quality')),
96
- complement(propEq)('9536', 'defindex')
97
- ]),
98
- chain(assoc('texture'), path(['static_attrs', 'paintkit_proto_def_index']))
99
- )
100
- )
101
- ),
102
- omit(['default']),
103
- mapObjIndexed((v, k) => assoc('defindex', k, v))
104
- ))
23
+ const WEAPON_SLOTS = new Set(['primary', 'melee', 'secondary', 'pda', 'pda2', 'building'])
105
24
 
106
- module.exports = { transformItems }
25
+ function transformItem(item) {
26
+ if (item.item_quality?.includes('paintkitweapon') && item.defindex !== '9536') {
27
+ item.texture = item.static_attrs?.['paintkit_proto_def_index']
28
+ }
29
+ if ('item_quality' in item) {
30
+ item.item_quality = qualityIds[item.item_quality.split(' ')[0]]
31
+ }
32
+ if (item.tool?.type === 'decoder_ring') item.type2 = 'key'
33
+ if (item.tool?.type === 'paint_can') item.type2 = 'paint'
34
+ if (item.attributes?.['cannot trade']?.value === '1') item.untradable = '1'
35
+ if (item.tags?.can_be_festivized === '1') item.festivized = '1'
36
+ if (item.attributes?.['tool target item']?.value) {
37
+ item.target = [item.attributes['tool target item'].value]
38
+ }
39
+ if (item.static_attrs?.['set supply crate series']) {
40
+ item.series = [item.static_attrs['set supply crate series']]
41
+ }
42
+ if (item.static_attrs?.['hide crate series number']) item.seriesHidden = true
43
+ if (item.static_attrs?.['tool target item']) {
44
+ item.target = [item.static_attrs['tool target item']]
45
+ }
46
+ if (!item.item_name) item.item_name = item.name
47
+ if ('used_by_classes' in item && !Array.isArray(item.used_by_classes)) {
48
+ item.used_by_classes = Object.keys(item.used_by_classes)
49
+ }
50
+ if (item.item_slot && item.used_by_classes?.length === 9) {
51
+ item.used_by_classes = ['all']
52
+ } else if (WEAPON_SLOTS.has(item.item_slot) && item.used_by_classes?.length >= 2 && item.used_by_classes?.length <= 8) {
53
+ item.used_by_classes = ['multi']
54
+ }
55
+
56
+ const picked = {}
57
+ for (const key of propsToKeep) {
58
+ if (key in item) picked[key] = item[key]
59
+ }
60
+ return picked
61
+ }
62
+
63
+ export function transformItems(collections, itemsApi, items) {
64
+ const transformedItems = {}
65
+ for (const [defindex, item] of Object.entries(items)) {
66
+ if (defindex === 'default') continue
67
+ transformedItems[defindex] = transformItem({ ...item, defindex })
68
+ }
69
+
70
+ const merged = [itemsApi, crateSeries, strangifierTargets, chemsetDefindex, transformedItems]
71
+ .reduce((acc, obj) => mergeDeepRight(acc, obj), {})
72
+
73
+ const result = {}
74
+ for (const [defindex, item] of Object.entries(merged)) {
75
+ result[defindex] = mergeDeepRight(collections[item.name] ?? {}, item)
76
+ }
77
+ return result
78
+ }
package/utils.js ADDED
@@ -0,0 +1,17 @@
1
+ export function mergeDeepWith(fn, a, b) {
2
+ const result = { ...b }
3
+ for (const [key, val] of Object.entries(a)) {
4
+ if (key in result && typeof val === 'object' && val !== null && typeof result[key] === 'object' && result[key] !== null) {
5
+ result[key] = mergeDeepWith(fn, val, result[key])
6
+ } else if (key in result) {
7
+ result[key] = fn(val, result[key])
8
+ } else {
9
+ result[key] = val
10
+ }
11
+ }
12
+ return result
13
+ }
14
+
15
+ export function mergeDeepRight(a, b) {
16
+ return mergeDeepWith((_, n) => n, a, b)
17
+ }
package/toSearchParams.js DELETED
@@ -1,99 +0,0 @@
1
- const {
2
- always,
3
- prop,
4
- ifElse,
5
- propEq,
6
- compose,
7
- defaultTo,
8
- __,
9
- map,
10
- applyTo,
11
- complement,
12
- allPass,
13
- includes
14
- } = require('ramda')
15
-
16
- const { safeItems: items } = require('./schemaItems.js')
17
- const { textures } = require('./schema.json')
18
- const { itemFromSku } = require('./sku.js')
19
-
20
- //collectors chem sets: output
21
- //strangifier chem sets, strangifier, unusualifier, kit, fab: target
22
-
23
- const item = ({ defindex, target, output }) => items[target || output || defindex].item_name
24
-
25
- const quality = ({
26
- defindex,
27
- quality,
28
- effect,
29
- texture,
30
- elevated
31
- }) => items[defindex].item_name === 'War Paint' || (Boolean(texture) || ['701', '702', '703', '704'].includes(effect))
32
- ? (elevated ? '11' : '5')
33
- : quality
34
-
35
- const australium = ifElse(
36
- propEq(true, 'australium'),
37
- always(1),
38
- always(-1)
39
- )
40
-
41
- const killstreak_tier = compose(
42
- defaultTo(0),
43
- prop('killstreakTier')
44
- )
45
-
46
- const craftable = ifElse(
47
- propEq(true, 'uncraftable'),
48
- always(-1),
49
- always(1)
50
- )
51
-
52
- const particle = prop('effect')
53
-
54
- const item_type = ({ target, output }) =>
55
- target
56
- ? 'target'
57
- : output
58
- ? 'output'
59
- : undefined
60
-
61
- const wear_tier = prop('wear')
62
-
63
- const texture_name = compose(prop(__, textures), prop('texture'))
64
-
65
- const elevated = ifElse(
66
- allPass([
67
- propEq(true, 'elevated'),
68
- compose(
69
- complement(includes)(__, ['701', '702', '703', '704']),
70
- prop('effect')
71
- )
72
- ]),
73
- always(11),
74
- always(undefined)
75
- )
76
-
77
- const fns = {
78
- item_names: always(1),
79
- item,
80
- quality,
81
- intent: always('dual'),
82
- australium,
83
- killstreak_tier,
84
- craftable,
85
- page_size: always(30),
86
- particle,
87
- item_type,
88
- texture_name,
89
- wear_tier,
90
- elevated
91
- }
92
-
93
- const toSearchParams = compose(
94
- map(__, fns),
95
- applyTo,
96
- itemFromSku
97
- )
98
-
99
- module.exports = { toSearchParams }
package/todo.txt DELETED
@@ -1,24 +0,0 @@
1
-
2
- option 1:
3
-
4
- call the sagas anywhere your redux-saga app + add the api context from the api.js
5
-
6
- const { fetchAppDataInventory } = require('@juice789/tf2items')
7
-
8
- function* fetchAppDataINvnetorySaga(inventory){
9
- const fetched = yield call(fetchAppDataINventry, inventory)
10
- }
11
-
12
- function* fetchInventorySaga(){
13
- yielt takeEvery('FETCH_INVENTORY', fetchAppDataInventorySaga)
14
- }
15
-
16
- option 2:
17
-
18
- initialize the library as a module, functions are available as promises
19
-
20
- const { getInstance } = require('@juice789/tf2items')
21
-
22
- const app = getInstance(options)
23
-
24
- app.saveSchema().then(console.log)