@juice789/tf2items 1.0.3 → 1.0.4
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/blanket.js +10 -6
- package/package.json +1 -1
package/blanket.js
CHANGED
|
@@ -24,7 +24,8 @@ const {
|
|
|
24
24
|
concat,
|
|
25
25
|
of,
|
|
26
26
|
unnest,
|
|
27
|
-
pick
|
|
27
|
+
pick,
|
|
28
|
+
mergeRight
|
|
28
29
|
} = require('ramda')
|
|
29
30
|
const { renameKeys } = require('ramda-adjunct')
|
|
30
31
|
|
|
@@ -101,17 +102,20 @@ const remaps = compose(
|
|
|
101
102
|
|
|
102
103
|
const propListDefault = ['killstreakTier', 'elevated', 'festivized', 'effect', 'texture', 'wear', 'craft', 'series']
|
|
103
104
|
|
|
104
|
-
const blanketify = uncurryN(3, (propList, skus,
|
|
105
|
-
map(
|
|
106
|
-
|
|
105
|
+
const blanketify = uncurryN(3, (propList, skus, item) => compose(
|
|
106
|
+
map(compose(
|
|
107
|
+
mergeRight(item),//merge the props with the item, keeping the assetid for use later
|
|
108
|
+
pick(['sku', 'originalSku']),
|
|
109
|
+
renameKeys({ _sku: 'sku', sku: 'originalSku' })//reset the sku, save the original sku
|
|
110
|
+
)),
|
|
107
111
|
filter(compose(includes(__, skus), prop('_sku'))),//find every new combination in the sku list
|
|
108
112
|
map(chain(assoc('_sku'), skuFromItem)),//save the new sku
|
|
109
113
|
unnest,
|
|
110
114
|
map(remaps),//decode defindices that are not possible anymore
|
|
111
|
-
map(omit(__, itemFromSku(sku))),//create items from the combinations
|
|
115
|
+
map(omit(__, itemFromSku(item.sku))),//create items from the combinations
|
|
112
116
|
concat([[]]),//create the last combination where no prop is removed. If the skus includes the sku we can return it.
|
|
113
117
|
chain(compose(getCombos(0), length), identity),//create every possible combination
|
|
114
|
-
filter(compose(Boolean, prop(__, itemFromSku(sku))))//remove every prop from proplist that is not present in the item
|
|
118
|
+
filter(compose(Boolean, prop(__, itemFromSku(item.sku))))//remove every prop from proplist that is not present in the item
|
|
115
119
|
)(propList || propListDefault))
|
|
116
120
|
|
|
117
121
|
module.exports = {
|