npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fnbr.js

v1.0.1

Published

This is a simple fnbr.co API wrapper to use their API in your NodeJS applications easily.

Downloads

17

Readme

fnbr.js

This is a simple wrapper for the fnbr.co API.

Remember to leave credit to fnbr.co in any applications that you make! This wouldn't be possible without them <3

Installation

To start, install this module using npm:

npm install fnbr.js --save

Setup

In order to use this package, you will need to get access to the fnbr.co API. This can be requested on the fnbr.co Discord server within the #request-api-access channel. You can then login using Discord on the fnbr.co website and generate your key here.

First, require the package.

const fnbrjs = require('fnbr.js');

Then, create a new fnbr.js client with your API key.

const fnbrjs = require('fnbr.js');
const fnbrco = new fnbrjs('example-api-key-12345-67890');

Please note that you should not hard code your API key.

If your API key is invalid, the package will error when creating the client.

Usage

There are 4 main methods within this package, as well as 1 extra for special cases.

getShop()

fnbrco.getShop().then(shop => {
	console.log(shop);
}).catch(err => {
	console.log(err);
});

This method will return a JSON object of the shop including the date that it was last updated, an array of featured items and an array of daily items.

{
	"date": "2019-05-28T00:00:00.000Z",
	"featured": [{}, {}],
	"daily": [{}, {}]
}

More information about the contents of each item object can be found here

getStats()

fnbrco.getStats().then(stats => {
	console.log(stats);
}).catch(err => {
	console.log(err);
});

This method will return an object containing the amount of items in each cosmetic type and cosmetic rarity.

{
	"totalCosmetics": 1809,
  	"matrix": [ 
		{ "type": "backpack",
			"rarity": [
				{ "rarity": "uncommon", "count": 8 },
				{ "rarity": "legendary", "count": 67 },
				{ "rarity": "marvel", "count": 2 },
				{ "rarity": "epic", "count": 135 },
				{ "rarity": "rare", "count": 52 } 
			]
		},
		{ "type": "emoji", "rarity": [] },
		{ "type": "outfit", "rarity": [] },
		{ "type": "emote", "rarity": [] },
		{ "type": "toy", "rarity": [] },
		{ "type": "umbrella", "rarity": [] },
		{ "type": "glider", "rarity": [] },
		{ "type": "wrap", "rarity": [] },
		{ "type": "skydive", "rarity": [] },
		{ "type": "pickaxe", "rarity": [] },
		{ "type": "music", "rarity": [] },
		{ "type": "pet", "rarity": [] },
		{ "type": "loading", "rarity": [] },
		{ "type": "spray", "rarity": [] },
		{ "type": "bundle", "rarity": [] } ],
	"unreleased": 23 
}

getUpcoming()

fnbrco.getUpcoming().then(upcoming => {
	console.log(upcoming);
}).catch(err => {
	console.log(err);
});

This method will return an array of upcoming items that have been datamined from the files, but have not yet appeared in the item shop.

[
	{},
	{},
	{}
]

More information about the contents of each item object can be found here

getItem(name, [limit], [type])

This method will accept up to 3 parameters.

| Parameter name | Description | Datatype | Example | Required | |---------------:|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|---------:|---------:| | name | A string of the full name of the cosmetic to search for. Case insensitive. | String | 'Raptor' | Yes | | limit | The maximum number of items to return based on the name. Must be between 1 and 15. Defaults to 1. | Integer | 3 | No | | type | Limit the returned results to a certain cosmetic type. Must be one of the following: backpack, emoji, emote, glider, loading, misc, music, outfit, pet, pickaxe, skydive, spray, toy, umbrella, wrap | String | 'outfit' | No |

fnbrco.getItem('Raptor').then(items => {
	console.log(items);
}).catch(err => {
	console.log(err);
});

or

fnbrco.getItem('Raptor', 3).then(items => {
	console.log(items);
}).catch(err => {
	console.log(err);
});

or

fnbrco.getItem('Raptor', 3, 'outfit').then(items => {
	console.log(items);
}).catch(err => {
	console.log(err);
});

This method will return an array of items that were found related to the search criteria. If no matches were found, an empty array will be returned.

[
	{},
	{}
]

or

[]

More information about the contents of each item object can be found here

get()

This method should only be used in special cases. For example, if fnbr.co add a new endpoint which this package has not been updated to support yet, you can use this method to send a GET request to a URL which has your API key header automatically assigned.

fnbrco.get('https://fnbr.co/api/new-endpoint').then(response => {
	console.log(response);
}).catch(err => {
	console.log(err);
});

This will return an axios request object. The response from fnbr.co itself can be found within the response.data.data property.

Item

Most endpoints will return objects that contain information about the cosmetic. Some properties of the item object are guaranteed to exist, however, some are not guaranteed.

An example of an item object can be seen below, along with comments describing each property.

{ 
	"id": "5cccd605077b8406ceadeb9b", // The ID of the item
    "name": "Dream", // The name of the item
    "price": "1,200", // The price of the item, either a price in vbucks or a season and tier for battle pass items
    "priceIcon": "vbucks", // The type of price for the item, either 'vbucks', 'vbook', 'vip' or 'fip'
	"priceIconLink": "https://image.fnbr.co/price/icon_vbucks.png", // The image URL of the price icon type
	"images": { // An object with multiple image types
		"icon": "https://image.fnbr.co/outfit/5cccd605077b8406ceadeb9b/icon.png", // The URL of the icon image
		"png": false, // The URL of the png image
		"gallery": false, // The URL of the gallery image
		"featured": "https://image.fnbr.co/outfit/5cccd605077b8406ceadeb9b/featured.png" // The URL of the featured image
	},
    "rarity": "rare", // The rarity of the item, either 'common', 'uncommon', 'rare', 'epic', 'legendary' or 'marvel'
    "type": "outfit", // The type of the item, either 'backpack', 'emoji', 'emote', 'glider', 'loading', 'misc', 'music', 'outfit', 'pet', 'pickaxe', 'skydive', 'spray', 'toy', 'umbrella' or 'wrap'
    "slug": "dream", // The slug of the item (used in item page URLs)
    "readableType": "Outfit", // The readable type of the item
	"description": "Light breaks through." // The description of the item
}

If an encrypted item appears in the item shop, the "icon" property within the "images" object will be the url of a placeholder for a while until a staff member of fnbr.co updated the image with the item icon.

For upcoming items, the price will be set to '???', the priceIcon and priceIconLink will be false.

Every item will have an "icon" URL within the images object, whether that is a placeholder image or the image of the item itself.

Only featured items will have a "featured" URL within the images object. This will be set to false if it does not have one.

Some items have a "png" URL within the images object. This will be set to false if it does not have one.

Some items have a "gallery" URL within the images object. THis will be set to false if it does not have one.

Support

If you require help with the fnbr.co API, please ask over on the fnbr.co Discord server in the #api-support channel or #support channel.

If you find an issue with this package, please contact me on one of the following:

@helloitsdann on Twitter

@dAn#0001 on Discord

[email protected] via email