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

system-requirements

v1.0.0

Published

Boxed software has 'em, now the web does too.

Downloads

3

Readme

system-requirements.js

"system requirements" is printed on the side of nearly every piece of packaged software on the planet.

But on the web we still build like it's 1999.

I thoroughly believe that in a lot of cases you get what you tolerate and we've been putting up with backward compatibility for ages and thus, crippling the awesomeness that is the web.

Let's build for the future of the web, not its past.

This makes it easy

  1. Optionally start with a string of minimium browser versions.
    • seperate browsers with 'or'
    • versions will be parsed as floats
    • you can add a "+" to the version number to indicate that anything above that is fine
    • if you don't specify a "+" it will look for the exact version number
    • acceptable browser names: opera, ie or msie, firefox or fx, safari, chrome
    • examples of valid browser strings:
      • chrome 20+ or firefox 20+ or safari 5+ (only)
      • safari 5 (will only pass for safari 5)
      • ie 8+ or chrome 5+ or fx 4+ or safari 5+
  2. Pass in any number of tests, these could be Modernizr tests or anything. If it returns true (or anything truthy) the test is considered passed.
  3. The systemRequirments function simply returns a boolean, true if requirements are met false if they're not.

sample uses:

// a string of acceptable browsers, redirect if not passing
if (!systemRequirements('chrome 25+ or firefox 20+ or safari 3+')) {
    // redirect to helpful page, etc.
    window.location = '/system-requirements';
}

// could also be a string of browsers + arbitrary tests
var someFunction = function () {return true;}
systemRequirements('chrome 25+ or firefox 20+ or safari 3+', someFunction, someFunction);

// or just tests and a fail url
systemRequirements(function () {return true;});

// you could have as many tests as you want, doesn't matter.
var someTest = function () {return true;};
systemRequirements(someTest, someTest, someTest, someTest, someTest, someTest);

That's it, that's all there is to it.

Changelog

  • 1.0.0 - change 'ff' to 'fx' as per #2 filed. Publishing 1.0.0 to adhere to semver.

If you dig it...

follow @HenrikJoreteg on twitter <3

License

MIT