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

@xananax/convenient

v0.0.9931

Published

A bunch of disparate, but convenient functions

Downloads

12

Readme

Convenient

A bunch of functions that I keep re-using. All collected here for profit & glory.

Contract

  • all functions are as small as possible (but no smaller). You can read the entire codebase quickly, and you can understand any function you want simply. They were designed so people can copy-paste them if needed.
  • no magic, everything is explicit.
  • functional when possible, but no dogma.
  • snake_case or camelCase names. Additionally, each function is exported as a name export and as a default, to please everyone.
  • all functions work in the browser and the server. When functionality doesn't make sense in one environment, then the function is replaced with a noOp procedure that does nothing. Feel free to use universal javascript
  • all and any async operations returns a promise, unless it really doesn't make sense
  • no stubs, polyfills, or other workarounds; you bring those yourself
  • entirely typescript-ed
  • each function is its own file, so you can import just what's needed
  • fully tested (not all of it yet, but coming up)

Be careful, the API is still in flux!

How to Use

Include the desired file:

import { load_image } from '@xananax/convenient/load_image'
// or, if you prefer camelCased identifiers:
import { loadImage } from '@xananax/convenient/load_image'

Or import everything at once:

import * as C from '@xananax/convenient'

C.load_image('path_to_image') // or C.loadImage

Another way to use the library is to simply refer to it as an example, and add your own implementation. There are no dependencies, nothing to install. Most modules are trying to be as independent as possible, and are designed to be easy to copy-paste elsewhere.

Using as little modules as possible is advised, both to avoid security fiascos (everyone remembers leftpad), and to keep the weight out of node_modules.

It also means you can tweak functions to do specifically what you need them to.

License

MIT