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

mxtorie-utils

v1.0.1

Published

Utils package, collection, print, check link, etc... All to be more faster and optimised.

Downloads

13

Readme

mxtorie-utils

For any question or support request : discord Other utils npm :

  • luma-db Like quick.db more advanced and online storage
  • mxtorie Advanced optimised mysql database managing

Features :

  • Collection
  • Print (replace console.log)
  • Sleep (replace setTimeout)
  • dateToEpoch (return a data to timestamp)
  • randomChar (return a random string)
  • randomNumber (return a random number)
  • isLink (check if the text contain a link)
  • toJSON (return a object to json)

Examples :

Print :

const {print} = require('mxtorie-utils')
print('hello') // will print 'hello' in the console
// print replace console.log

To use print anywhere :

global.print = require('mxtorie-utils').print
// you can now use print() in all files without import it

Sleep :

const {print, sleep} = require('mxtorie-utils')
print('hello')
await sleep(2000) // await is VERY important !
print('hello 2 seconds after')

Collection :

  • Not all features will be showed.
const {Collection, print} = require('mxtorie-utils')
const data = new Collection() //you can set a default value (object) in the ()

data.set('key1', 1) //set 1 in the collection where the key is 'key1'
print(data.get('key1')) // 1
print(data.has('key1')) // true
data.set('key2', 2) //set 2 in the collection where the key is 'key2'
let allData = data.all()
print(allData) // [{key: 'key1', data: 1}, {key: 'key2', data: 2}]

print(data.first()) // 1
print(data.firstKey()) // key1
print(data.last()) // 2
print(data.lastKey()) // key2
print(data.at(1)) // 2
print(data.keyAt(1)) // key2

data.clear() // clear the collection
data.set('firstKey', 1).set('secondKey', 2)
print(data.all()) // [{key: 'firstKey', data: 1}, {key: 'secondKey', data: 2}]
data.reverse() //reverse the collection
print(data.all()) // [{key: 'secondKey', data: 2}, {key: 'firstKey', data: 1}]

let find = data.find(v => v === 2)
print(find) // [ 2 ]
let findComplete = data.find(v => v === 2, true)
print(findComplete) // [{key: 'secondKey', data: 2}]
let findOne = data.findOne(v => v === 2)
print(findOne) // 2
let findOneComplete = data.findOne(v => v === 2)
print(findOneComplete) // {key: 'secondKey', data: 2}

print(data.filter(v => v === 2).all()) // [{key: 'secondKey', data: 2}]
data.delete('secondKey') // will delete the value where key is 'secondKey'

data.save('./mySave.json') // will save all data of the collection
print(data.all()) // [{key: 'firstKey', data: 1}, {key: 'secondKey', data: 2}]
let newData = new Collection()
newData.getSave('./mySave.json')
print(newData.all()) // [{key: 'firstKey', data: 1}, {key: 'secondKey', data: 2}]

let perfectClone = data.clone()
print(perfectClone) // [{key: 'firstKey', data: 1}, {key: 'secondKey', data: 2}]

/* AND MORE... LIKE FOREACH, MAP, ETC... */

isLink :

const {print, isLink} = require('mxtorie-utils')
print(isLink('hello its me')) // false
print(isLink('https://discord.gg/mxtorie')) // true

And more functions ...