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

azul-tools

v1.9.26

Published

Some tools that i use in my projects..

Downloads

25

Readme

Azul Tools

npm version npm downloads license

Prerequisites

This is being used, and tested with Node V14+, it might not work in lower versions.

Installing

npm install azul-tools

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • Almost every Method returns a promise, so you can use await or then
  • Thats all folks!

Constructors

Tester(string)

Usefully to test how much time it will get to do something

  • string the name of the tester, use this to identify things

Usage

const AzulTools = require('azul-tools);
const Test = new AzulTools.Tester('cool function');

**do something that you want to know how long will take**

Test.end(true); // will say on console => cool function took (x)ms, where (x) is the time that it tooks

Methods

sleep(ms)

Returns a promise that is solved after ms miliseconds, good to use await or then

  • ms time in miliseconds

isURL(str)

Checks if str is a valid valid url, by returning true or false

  • str desired string to do the magic

isTradeOfferURL(str)

Checks if str is a valid trade offer url, by returning true or false

  • str desired string to do the magic

isValidSteamID(str)

Checks if str is a valid SteamID, by returning true or false

  • str desired string to do the magic

isSteamID64(str)

Checks if str is a valid SteamID64, by returning true or false

  • str desired string to do the magic

GetSteamID64FromURL(str)

Returns the first SteamID64 found in a desired string, can return null if didn't manage to find any

  • str desired string to do the magic

TimeStamp(date)

Return an object with a formated date YYYY-MM-DD and time HH:mm:ss of the date date or the current system time if ommited.

  • date date to be formated, if null or ommited, will use current system time

formatNumber(number)

Format a number to make it more readable (e.g transforms 9999 to 9,999)

  • number number to be formated

readJSON(filepath)

Safe load a JSON file and parse it, if file doesn't exists, or if it fails to parse the json(bad json), it will return an emptry json.

  • filepath obvious, the filepath..

Log(String) blue

Log.Warn(String) yellow

Log.Trade(String) green

Log.Debug(String, json, DebugMode) grey

Log.Error(String) red

Smart use of storeFile(), TimeStamp() and colors.js to save logs, with smooth organization by dates, times and sections

  • String Log message you want to display on the console, and store.
  • json If you passing a JSON content, set to true, it will use JSON.stringify() on String.
  • DebugMode True if you want the console to display the message, false otherwise, but even if false, it will save the logs.

storeChatData(UserID64, Message, Bot, server_timestamp)

Smart use of storeFile() and TimeStamp() to save SteamChat logs, with smooth organization by dates, times, and SteamIDS.

  • UserID64 is the SteamID64 of user
  • Message is the message content
  • Bot True if its a bot message (bot has sent the message), false if otherwise (if null or ommited, will be false)
  • server_timestamp UTC timestamp that you need to be stored, if null or ommited, will pick the current UTC system time.

storeFile(filePath, fileContent, flag)

Safe store a file to a desired filePath, and auto create any extra directory if needed, it uses graceful-js so we don't need to worry about commom issues.

  • filePath is the target filePath
  • fileContent is the file content, please beware that it don't handle json, so you need to use JSON.stringify()
  • flag it the fs flag, commom ones are w for writing, and a for appending (if null or ommited, will pick appending)