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

informing

v1.0.9

Published

A simple, ridiculously small module (the module itself is <2KB, excluding the README, LICENSE, and package.json files) to get information about various things

Downloads

13

Readme

Informing

A simple, ridiculously small module (the module itself is <2KB, excluding the README, LICENSE, and package.json files) to get information about various things


Installation:

npm i informing

Then require() it in your code. Done!

Or if you're in a browser, :

Use a CDN to import it onto your website:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/index.js"></script>

This will pull in the latest version of Informing that doesn't have breaking changes, which I can't see a simple library like this having. To pull in the latest version, even with potential breaking changes.


Informing supports:

defaults
maintained node versions
not ie 11
not ie_mob 11

BrowsersList


Usage

informing.agent()

informing.agent()

Returns the browser's user agent. Returns null in NodeJS.


informing.argv()

informing.argv()

Returns the arguments passed to the program through the CLI. Returns null in the browser.


informing.baseURL()

informing.baseURL()

Returns the origin of the URL. Returns null in NodeJS.


informing.day()

informing.day()

Returns the current day (for example, if today was January 1st, it would return 1, because today is the first day of the month). Supported in both NodeJS and the browser.


informing.dayOfWeek([number])

informing.dayOfWeek()
// OR
informing.dayOfWeek(true)

Returns day of the week. Returns a string ("Sunday", "Monday", "Tuesday", etc.) if the parameter is left alone or set to false or a falsy value. If it's set to true or a truthy value, it returns the default value of new Date().getDay(). Supported in both NodeJS and the browser.


informing.directory()

informing.directory()

Returns the directory where the JS file is located. Not necessarily the current working directory (the path returned by pwd). Returns null in the browser.


informing.environment()

informing.environment()

Returns "node" or "browser", depending on where the code's being run. Supported in both NodeJS and the browser (obviously).


informing.file()

informing.file()

Similar to informing.directory(), but it returns the file path, not the directory that the file's in. Returns null in the browser.


informing.hash()

informing.hash()

Returns the URL hash. Returns null in NodeJS.


informing.host()

informing.argv()

Like informing.baseURL(), but it also includes the protocol. Returns null in NodeJS.


informing.hostname()

informing.argv()

Like informing.host(), but it also includes the port (In https://www.example.com:8000, www.example.com is the host, but www.example.com:8000 is the host name). Returns null in NodeJS.


informing.hour()

informing.hour()

Returns the current hour (for example, if it was 4:00 PM, informing.hour() would be 16). Supported in both NodeJS and the browser.


informing.millisecond()

informing.millisecond()

Returns the current millisecond. Supported in both NodeJS and the browser.


informing.minute()

informing.minute()

Returns the current minute. Supported in both NodeJS and the browser.


informing.month([number])

informing.month()
// OR
informing.month(true)

Returns day of the week. Returns a string ("January", "February", "March", etc.) if the parameter is left alone or set to false or a falsy value. If it's set to true or a truthy value, it returns the default value of new Date().getMonth(). Supported in both NodeJS and the browser.


informing.pathname()

informing.pathname()

Gives the current path. For example, if the URL was, https://www.example.com/path/to/a/file.html, informing.pathname() would be /path/to/a/file.html. Returns null in NodeJS.


informing.port()

informing.port()

Returns the port (for example, if the URL was https://www.example.com:8000, informing.port() would return 8000). Returns null in NodeJS.


informing.protocol()

informing.protocol()

Returns the protocol (for example, if the URL was https://www.example.com, informing.protocol() would return https:). Returns null in NodeJS.


informing.query()

informing.query()

Returns the query string part of the URL (for example, if the URL was https://www.example.com?myquerystring&otherquerystring=xyz, informing.query() would return ?myquerystring&otherquerystring=xyz). Returns null in NodeJS.


informing.second()

informing.second()

Returns the current second. Supported in both NodeJS and the browser.


informing.URL()

informing.URL()

Returns the full URL. Returns null in NodeJS.