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

@flavs/nodedash

v1.0.2

Published

Node v10 typescript test driven web app

Downloads

21

Readme

Test Node Typescript

Test Driven Node v10 Typescript Web App

docs

nodedash v1.0.0

Import

  • _n._n_import
  • _n._n_modules

Require

  • _n.require

Date

  • _n.date
  • _n.now
  • _n.getTimestamp
  • _n.isDate

Math

  • _n.addDays
  • _n.subtractDays

Import

Import using esm or TypeScript

Since

1.0.0

Example

import _n from 'nodedash'

_n.date('3/14/2019', 'uk')
// => 14 Mar 2019

_n.addDays('3/6/19', 1, '-')
// => 03-07-2019

_n.subtractDays('3/6/19', 1, '-')
// => 03-05-2019

Import individual ES Modules using esm or TypeScript

Since

1.0.0

Example

import { addDate, subtractDate } from 'nodedash'

addDays('3/6/19', 1, '-')
// => 03-07-2019

subtractDays('3/6/19', 1, '-')
// => 03-05-2019

Require

Import using require

Since

1.0.0

Example

const _n = require('nodedash')

_n.date('3/14/2019', 'uk')
// => 14 Mar 2019

_n.addDays('3/6/19', 1, '-')
// => 03-07-2019

_n.subtractDays('3/6/19', 1, '-')
// => 03-05-2019

“Date” Methods

Computes input date converts to string and returns with specified format.

Since

1.0.0

Arguments

  1. Date (date): options are new Date(), timestamp or string in valid date format. See example below.
  2. format (string):

Returns

(string): Returns the date as a String in specified format.

Example

let any_nate = "1/07/2019"

_n.date(any_nate, '/')
// => 01/07/2019

_n.date(any_nate, '-')
// => 01-07-2019

_n.date(any_nate, '.')
// => 01.07.2019

_n.date(any_nate, 'MMM DD YYYY')
// => Jan 07 2019

_n.date(any_nate, 'england')
// => 07 Jan 2019

_n.date(any_nate, 'uk')
// => 07 Jan 2019

_n.date(any_nate, 'full')
// => Mon Jan 07 2019 00:00:00 GMT-0700 (Mountain Standard Time)

Gets the timestamp of the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC).

Since

1.0.0

Returns

(number): Returns the timestamp.

Example

const { defer } = require('lodash')

defer(function(stamp) {
  console.log(_n.now() - stamp)
}, _n.now())

// => Logs milliseconds it took for the deferred invocation.

Gets the timestamp of the number of milliseconds that have elapsed since date argument. If date is undefined it gives milliseconds elapsed since the Unix epoch (1 January 1970 00:00:00 UTC).

Since

1.0.0

Arguments

  1. Date (date): to convert to timestamp.

Returns

(number): Returns the timestamp.

Example

_n.getTimestamp('July 4 1776')
// => 121244400000

_n.getTimestamp()
// => 1552353178563
// returns now timestamp

_n.getTimestamp('11/4/1973')
// => -6106035604000

Verifies if value is a valid Date object and valid Date.

Since

1.0.0

Arguments

  1. value (*): The value to check.

Returns

(boolean): Returns true if value is a Date object & valid Date, else false.

Example

_n.isDate('3/3/19')
// => true

_n.isDate(new Date())
// => true

_n.isDate('Jul 4 1776')
// => true

_n.isDate(25200000)
// => true

_n.isDate('3/33/19')
// => false

function getDate() {
    return '1/1/19'
}
_n.isDate(getDate)
// => false

_n.isDate(getDate())
// => true

“Math” Methods

Input _nate add nDays with format

Since

1.0.0

Arguments

  1. Date (date):
  2. days (number): to add
  3. format (string):

Example

const any_nate = '3/6/19'

_n.addDays(any_nate, 1, '-')
// => 03-07-2019

_n.addDays(any_nate, 2, '.')
// => 03.08.2019

_n.addDays(any_nate, 3, 'uk')
// => 09 Mar 2019

Input _nate subtract nDays with format

Since

1.0.0

Arguments

  1. Date (Date):
  2. days (number): to subtract
  3. format (string):

Example

const any_nate = '3/6/19'

_n.subtractDays(any_nate, 1, '-')
// => 03-05-2019

_n.subtractDays(any_nate, 2, '.')
// => 03.04.2019

_n.subtractDays(any_nate, 3, 'uk')
// => 03 Mar 2019