mfers.js
- access trait metadata for all mfers
- metadata compressed by 100x
- works in any js environment: browser, workers, Bun, NodeJS, Deno
Install
bun install mfers
import { getMfers, findMfers, describe, background_colors } from 'mfers';
API
getMfers
Returns an ordered array of mfer metadata. Index in array = mfer token id (mfer #6308 ~> mfers[6308]
)
import { getMfers } from 'mfers';
let mfers = getMfers()
mfers[6308].id // ~> 6308
mfers[6308].traits
// {
// background: "blue",
// type: "plain mfer",
// eyes: "regular eyes",
// "hat under headphones": "bandana dark gray",
// headphones: "black headphones",
// mouth: "flat",
// smoke: "cig white",
// }
// ---
// shortcut to iterate over traits
for(let [trait,variant] of mfers[6308]){
console.log({ trait, variant })
}
findMfers(filter={})
Filter mfers based on trait lists. Each key is a trait_type
or category
, and each value is an array of acceptable variants.
import { findMfers } from 'mfers'
findMfers({
background: ["red","blue"],
type: ["plain mfer", "charcoal mfer"],
smoke: ["none"]
})
// ~> [...675 mfers]
oneofones
an array of the 21 1/1 mfer ids.
import { oneofones } from 'mfers'
console.log(oneofones)
[140,781,1825,2293,2506,3942,4482,5476,5659,5688,6551,7456,7503,8434,8618,9035,9205,9292,9547,9860,9967]
traits
An object containing all possible variations for each trait. traits are directly from the mfers metadata.
import { traits } from 'mfers';
Object.keys(traits)
// ~> [ "chain", "hat over headphones", "short hair", ... ]
traits['chain']
// ~> [ "silver chain", "gold chain" ]
traits['hat over headphones']
// ~> [ "cowboy hat", "top hat", "hoodie", "pilot helmet" ]
categories
An object containing all possible variations for each category. categories combine certain traits. shirt + chain = clothes. short hair + long hair = hair. hat under headphones + hat over headphones = hat. the value array contains an null
if the category is optional.
import { categories } from 'mfers';
Object.keys(categories)
// ~> [ "background", "hat", "hair", ... ]
describe(trait_obj)
A function that describes arbitrary trait combinations using plain english, ideal for LLMs and GPTs. This was used for MferGPT