@poprank/rankings
Advanced tools
Comparing version 1.1.17 to 1.1.18
@@ -13,2 +13,11 @@ "use strict"; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -44,6 +53,6 @@ exports.getAllNftsRarity = exports.getMetaTraits = exports.calculateTraitScore = void 0; | ||
var pushTraitToCollectionTraits = function (collectionTraits, trait) { | ||
var value = trait.value, typeValue = trait.typeValue; | ||
var value = trait.value, typeValue = trait.typeValue, category = trait.category; | ||
if (!collectionTraits[typeValue]) | ||
collectionTraits[typeValue] = []; | ||
var alreadySeenTraitIndex = collectionTraits[typeValue].findIndex(function (t) { return t.value === value && t.typeValue === typeValue; }); | ||
var alreadySeenTraitIndex = collectionTraits[typeValue].findIndex(function (t) { return t.value === value && t.typeValue === typeValue && t.category === category; }); | ||
var alreadySeenTrait = collectionTraits[typeValue][alreadySeenTraitIndex]; | ||
@@ -161,3 +170,3 @@ if (alreadySeenTraitIndex === -1) { | ||
nfts.forEach(function (nft) { | ||
var _a; | ||
var traits = nft.traits.slice(); | ||
if (rarity_meta_1.ensCollectionSlugs.includes(collection)) { | ||
@@ -179,3 +188,3 @@ var max = rarity_meta_1.ensCollectionSizes[collection]; | ||
} | ||
nft.traits.push({ | ||
traits.push({ | ||
value: i.toString(), | ||
@@ -187,3 +196,10 @@ category: 'Traits', | ||
} | ||
(_a = nft.traits).push.apply(_a, (0, exports.getMetaTraits)(nft.traits, nft.collection, true)); | ||
// Check if the collection has its own "None" trait. If it does, ensure we correctly set its | ||
// category to "None". Naive check for now, make more intelligent in the future | ||
var noneTraits = traits.filter(function (t) { return t.value.toLowerCase() === 'none'; }); | ||
if (noneTraits.length) { | ||
traits = __spreadArray(__spreadArray([], traits.filter(function (t) { return t.value.toLowerCase() !== 'none'; }), true), noneTraits.map(function (t) { return (__assign(__assign({}, t), { category: 'None' })); }), true); | ||
} | ||
traits.push.apply(traits, (0, exports.getMetaTraits)(nft.traits, nft.collection, true)); | ||
nft.traits = traits; | ||
}); | ||
@@ -190,0 +206,0 @@ var nftsWithRarity = []; |
{ | ||
"name": "@poprank/rankings", | ||
"version": "1.1.17", | ||
"version": "1.1.18", | ||
"description": "PopRank's NFT rarity and aesthetic ranking logic", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60501
798