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

fat-tony

v1.0.1

Published

*The name is inspired by Tony Soprano for his "break the rules" approach, and also "Fat Tony" a recurring character in the works of Nassim Nicholas Taleb who embodies street smarts and thrift.*

Downloads

12

Readme

What is Fat Tony?

The name is inspired by Tony Soprano for his "break the rules" approach, and also "Fat Tony" a recurring character in the works of Nassim Nicholas Taleb who embodies street smarts and thrift.

The problem Fat Tony aims to solve is that when working with JavaScript it feels like a drag to pollute your codebase with lots of thens or import some crazy library or npm package (especially if what you REAAALLY want to do is grab the data from a fetch -- ONCE -- and then mutate it 6 ways from Sunday)!

While Fat Tony isn't a solution for every situation, it enables you to capture data from a fetch essentially as a one off, so you can then work on it in your codebase, almost as if it were a regular variable. Granted, you need to write you code inside of a function which you pass to your declared invocation of theFattestTony but if you're prototyping something, and don't want to deal with the baggage of writing lots of functions when you aren't exactly sure what you'll need, or not -- then Fat Tony helps provide you with enough support to get you running quickly... as for then, Fat Tony works with it behind the scenes, but hopefully in a way that's unobtrusive enough to feel like an afterthought.


As Tony Soprano might say: "The dog not only fetches, but it STAYS."

EXAMPLE OF HOW TO USE FAT TONY

AFTER YOU NPM INIT YOUR PROJECT... make sure to include the following line at the top of the file you intend to use Fat Tony in...

const { theFattestTony } = require("fat-tony");

YOU NEED A SHIPMENT...

const theShipment = [
  { keyForFetch1: "url_for_fetch1" },
  { keyForFetch2: "url_for_fetch2" },
  { keyForFetch3: "url_for_fetch3"}
]

YOU NEED A PROGRAM TO RUN IT ALL IN

function runMyProgram(receivesAnObjectWithTheResultsFromTheShipment) {
  const variableForLocalUse = receivesAnObjectWithTheResultsFromTheShipment 
  const accessForResultOfFetch1 = variableForLocalUse["keyForFetch1"]
  const accessForResultOfFetch2 = variableForLocalUse["keyForFetch2"]
  const accessForResultOfFetch3 = variableForLocalUse["keyForFetch3"]

  // you don't have to do it like that...
  // but you can now write your code in such a way that you can treat the
  // results of the fetch almost like local variables
  // you can also nest this logic
}

THIS IS WHERE THE MAGIC HAPPENS

let myFatTony = fatTony //required from the package
myFatTony(theShipment, runMyProgram)

YOU CAN ALSO CUT AND PAST THE FOLLOWING CODE FOR A COMPLETE TESTING EXPERIENCE!

const { theFattestTony } = require("fat-tony");

function theMainAttraction(theLedger) { // THIS IS YOUR MAIN LOOP
  //YOU CAN NOW MUTATE DATA AS IF IT WERE A REGULAR VARIABLE!!!
  const localLedger = theLedger
  console.log("\n\n")
  console.log("...... THE FIRST RUN\n", localLedger)
  console.log("\n")
  localLedger["sampleBot"].theeResponseObject[0] = "I CHANGED TO THIS"
  localLedger["sampleBot"].theeResponseObject[1] = "I CHANGED THIS, TOO"
  console.log("THIS IS THE ARRAY", localLedger["sampleBot"].theeResponseObject[6])
  localLedger["sampleBot"].theeResponseObject[6] = localLedger["sampleBot"].theeResponseObject[6].map((x) => { return x.toUpperCase() })
  console.log("THIS IS THE ARRAY CHANGED", localLedger["sampleBot"].theeResponseObject[6])
  console.log("\n")
  console.log("...... THE SECOND RUN AFTER ALTERED DATA\n", localLedger)
  console.log("\n\n")
  // YOU CAN ALSO CREATE A SUB-ROUTINE 
  function sideShow(decks) {
    console.log("WELCOME TO THE SIDEHOW")
    console.log("THIS IS DECK 1 REQUEST", decks["deck1"])
    console.log("THIS IS DECK 2 REQUEST", decks["deck2"])
    console.log("THIS IS DECK 3 REQUEST", decks["deck3"]) 
    console.log("BUT WE ALSO THE LOCAL LEDGER FROM ONE LEVEL UP!!")
    console.log("THE LOCAL LEDGER", localLedger)  
  }
  let junior = theFattestTony()
  let juniorsShipment = [
    { deck1: "https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1"},
    { deck2: "https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1"},
    { deck3: "https://deckofcardsapi.com/api/deck/new/shuffle/?deck_count=1"}
  ]
  junior(juniorsShipment, sideShow)
  
  // IN OTHER WORDS...
  // WRITE THE REST OF YOUR PROGRAM INSIDE THE MAIN ATTRACTION, OR WHATEVER YOU WANT TO CALL IT
}
const theShipment = [
  { sampleBot: "https://s0crates.herokuapp.com/sampleBot/chatAPI" },
  { ghostWriter: "https://s0crates.herokuapp.com/gh0stwr1ter/chatAPI" }]
//RUN YOUR PROGRAM LIKE SO: 
let antonio = theFattestTony()
antonio(theShipment, theMainAttraction)