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

temporalts

v1.1.0

Published

temporalts is a module that leverages [Moment](https://www.npmjs.com/package/moment) (apologies, Maggie!) and the [schedule.json](https://github.com/nodejs/Release/blob/master/schedule.json) file published in the Node.js Release WG repo to generate tempor

Downloads

6

Readme

temporalts

temporalts is a module that leverages Moment (apologies, Maggie!) and the schedule.json file published in the Node.js Release WG repo to generate temporal information about Node.js release lines.

Installation

npm install temporalts

Usage

temporalts can pass all Node.js LTS release line temporal information, or the temporal information for a specific release line.

temporalts()

Returns Promise<Object> - an object where each key is the name of a release line and the property of each key is an object that includes several instances of Moment and some additional useful information that is derived from those instances of Moment.

Example:

const temporalts = require('temporalts')

async function timeUntilEachLineGoesEOL() {
  const lts = await temporalts()

    for (let [key, ltsTime] of Object.entries(lts)) {
      console.log(`One percent of the Node.js ${key} LTS release line's lifespan is ${ltsTime.onePercentOfLTSLifeSpanInDays} days.`)
    }
}

timeUntilEachLineGoesEOL()

temporalts(version) (release line temporal information for version)

  • version String - A string representing a maintained release line format. Must be in a recognizable version format, or an error will be thrown.
    • Valid examples for Node.js' v12 release line would include: v12, 12, v12.x, 12.x.y, 12.x, or v12.x.y.

Returns Promise<Object> - resolves an Object containing the following properties:

  • now: An instance of moment() which is the current moment in time.
  • timeframeStart: An instance of moment that is the beginning of the LTS window of a given release's lifespan.
    • Important: This is not the original release of the LTS release line as Current, but rather the moment it moved from Current to LTS.
  • timeframeEnd: An instance of moment that is the moment a given release line goes End of Life (EOL).
  • diffStartAndEnd: Difference (in milliseconds) between timeframeStart and timeframeEnd.
  • diffNowAndStart: Difference (in milliseconds) between now and timeframeStart.
  • diffNowAndEnd: Difference (in milliseconds) between now and timeframeEnd.
  • onePercentOfLTSLifeSpanInMilliseconds: A calculation (in milliseconds) of 1% of the lifespan of a given release.
  • onePercentOfLTSLifeSpanInDays: A calculation (in days) of 1% of the lifespan of a given release.
  • currentPercentOfLTSLifeSpan: Gives the raw (including decimal) percentage of time that has passed from the beginning to the end of a given release's LTS lifespan.
  • currentPercentOfLTSLifeSpanWithoutDecimal: Gives the more human-friendly (exclusing decimal) percentage of time that has passed from the beginning to the end of a given release's LTS lifespan.
  • currentPercentOfLTSLifeSpanAsProgressBar: Proives a progress bar (using the charachters [, =, , and ]) that shows the current progress of a given release's lifespan in a visual format.
  • fromNowToEnd: Human-readable time from now to the end of the LTS window.
  • fromLTSStartToNow: Human-readable time from the start of the LTS window to now.

Below is an example of of one entry. You will get several of these as properties of their respective versions as keys if you execute the module without passing a version.

{
    "now": "2020-01-02T03:44:02.171Z",
    "timeframeStart": "2018-10-30T04:00:00.000Z",
    "timeframeEnd": "2021-04-30T04:00:00.000Z",
    "diffStartAndEnd": 78883200000,
    "diffNowAndStart": 37064642171,
    "diffNowAndEnd": 41818557829,
    "onePercentOfLTSLifeSpanInMilliseconds": 788832000,
    "onePercentOfLTSLifeSpanInDays": 9.13,
    "currentPercentOfLTSLifeSpan": 46.98673757023042,
    "currentPercentOfLTSLifeSpanWithoutDecimal": 46,
    "currentPercentOfLTSLifeSpanAsProgressBar": "[=========           ]",
    "fromNowToEnd": "in a year",
    "fromLTSStartToNow": "a year ago"
}
  • You must only pass versions that map to an LTS release line. In Node.js, all even versions were, are, or will be LTS release lines.
  • Data will only be returned for versions that exist in the schedule.json file the Node.js Release WG maintains.
    • Generally, this is 1 LTS ahead of the currently published version that is or will be an LTS version.

Example:

const temporalts = require('../')

async function prettyPrint () {
  const version = 'v12'
  const data = await temporalts(version)

  const percentDecimal = data.currentPercentOfLTSLifeSpanWithoutDecimal
  const percentProgress = data.currentPercentOfLTSLifeSpanAsProgressBar
  console.log(`We are ${percent}% through the lifespan of the Node.js ${version} LTS release line.\n`)
  console.log(percentProgress)
}

prettyPrint()