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

node-simplify

v1.0.0

Published

Node Simplify is a versatile npm package designed to empower developers by simplifying complex tasks and enhancing productivity. Packed with a robust collection of meticulously crafted helper functions, Node Simplify Function streamlines various functiona

Downloads

11

Readme

Node Simplify

Introducing "Node Simplify" – Your Ultimate Developer Companion!

Node Simplify is a versatile npm package designed to empower developers by simplifying complex tasks and enhancing productivity. Packed with a robust collection of meticulously crafted helper functions, Node Simplify Function streamlines various functionalities, enabling developers to achieve more with less effort. No matter the node version of your project it works with all.

Click here to give any suggestions or report an issue

NOTE: This package will be updated more as the time progress.

Getting started

Installation

npm i node-simplify

Date Helper

The "DateHelper" is a versatile utility that streamlines working with dates in programming. It provides an array of formatting, comparison, and manipulation. By simplifying complex temporal operations, this function enhances efficiency and accuracy in date-related programming tasks.


Example:
import { DateHelper } from 'node-simplify';

Available Functions

  • DateHelper.format
Options:

| Parameter | Required | Default | | ------------- | -------- | ----------------- | | Date Object | Yes | Current date time | | Format String | Yes | y-m-d H:i:s |

Available format charecter:

| Format Character | Description | Example returned values | | ----------------- | --------------------------------------------------------------------------------- | ------------------------ | | Day | --- | --- | | d | Day of the month, 2 digits with leading zeros | 01 to 31 | | D | A textual representation of a day, three letters | Mon through Sun | | j | Day of the month without leading zeros | 1 to 31 | | l (lowercase 'L') | A full textual representation of the day of the week | Sunday through Saturday | | Month | --- | --- | | F | A full textual representation of a month, such as January or March | January through December | | m | Numeric representation of a month, with leading zeros | 01 through 12 | | M | A short textual representation of a month, three letters | Jan through Dec | | n | Numeric representation of a month, without leading zeros | 1 through 12 | | Year | --- | --- | | Y | A full numeric representation of a year, at least 4 digits, with - for years BCE. | Examples: 2022, 2023 | | y | A two digit representation of a year | Examples: 99 or 03 | | Time | --- | --- | | a | Lowercase Ante meridiem and Post meridiem | am or pm | | A | Uppercase Ante meridiem and Post meridiem | AM or PM | | g | 12-hour format of an hour without leading zeros | 1 through 12 | | G | 24-hour format of an hour without leading zeros | 0 through 23 | | h | 12-hour format of an hour with leading zeros | 01 through 12 | | H | 24-hour format of an hour with leading zeros | 00 through 23 | | i | Minutes with leading zeros | 00 to 59 | | s | Seconds with leading zeros | 00 through 59 |


Example:
DateHelper.format(new Date(), 'Y-m-d H:i:s'); // 2023-08-15 15:25:00

  • DateHelper.format12hours
Options:

| Parameter | Required | | ----------- | -------- | | Time String | Yes |

Example:
DateHelper.format12hours('13:30'); // 01:30 PM

  • DateHelper.generateHours
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Time Interval | Yes | 10 |

Example:
DateHelper.generateHours(10); // ['00:00', '00:10', '00:20', '00:30', '00:40', '00:50', '01:00', '01:10', '01:20', '01:30', '01:40', ...]

  • DateHelper.getLastNYears
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Integer | Yes | 10 |

Example:
DateHelper.getLastNYears(10); // [2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014]

  • DateHelper.getDateRange
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Start date | Yes | null | | Endd ate | Yes | null |

Example:
DateHelper.getDateRange('2020-01-01', '2020-01-02'); // [2020-01-01T00:00:00.000Z, 2020-01-02T00:00:00.000Z]

  • DateHelper.addDays
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Date | Yes | null | | No. of days | Yes | null |

Example:
DateHelper.addDays('2020-01-01', 10); // 2020-01-11T00:00:00.000Z

  • DateHelper.addMonths
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Date | Yes | null | | No. of Months | Yes | null |

Example:
DateHelper.addMonths('2020-01-01', 5); // 2020-06-01T00:00:00.000Z

  • DateHelper.addYears
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Date | Yes | null | | No. of Years | Yes | null |

Example:
DateHelper.addYears('2020-01-01', 5); // 2025-01-01T00:00:00.000Z

  • DateHelper.subtractDays
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Date | Yes | null | | No. of Days | Yes | null |

Example:
DateHelper.subtractDays('2020-01-01', 5); // 2019-12-27T00:00:00.000Z

  • DateHelper.subtractMonths
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Date | Yes | null | | No. of Monts | Yes | null |

Example:
DateHelper.subtractMonths('2020-01-01', 5); // 2019-08-01T00:00:00.000Z

  • DateHelper.subtractYears
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Date | Yes | null | | No. of Years | Yes | null |

Example:
DateHelper.subtractYears('2020-01-01', 10); // 2010-01-01T00:00:00.000Z

  • DateHelper.getDateDifference
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Date 1 | Yes | null | | Date 2 | Yes | null |

Example:
DateHelper.getDateDifference('2020-01-01', '2020-01-05'); // 4

  • DateHelper.isDateBefore
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Date 1 | Yes | null | | Date 2 | Yes | null |

Example:
DateHelper.isDateBefore('2020-01-01', '2020-01-05'); // true

  • DateHelper.isDateAfter
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Date 1 | Yes | null | | Date 2 | Yes | null |

Example:
DateHelper.isDateAfter('2020-01-01', '2020-01-05'); // false

  • DateHelper.timeAgo
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Date Time | Yes | null |

Example:
DateHelper.timeAgo('2023-01-01'); // 1 year ago

Image Helper

The ImageHelper is a convenient utility to manupilate image datal

Example:
import { ImageHelper } from 'node-simplify';
  • ImageHelper.fileToBase64
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Image File | Yes | null |

Example:
ImageHelper.fileToBase64(<file>); // returns base64 of a file

  • ImageHelper.base64toFile
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Base64 Image data | Yes | null | | File name without extention | Yes | null |

Example:
ImageHelper.base64toFile(<base64>, <name>) // returns file

Address Helper

The AddressHelper is a convenient utility to manupilate Address details

Example:
import { AddressHelper } from 'node-simplify';
  • AddressHelper.getDistanceInKm
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Latitude 1 | Yes | null | | Longitude 1 | Yes | null | | Latitude 2 | Yes | null | | Longitude 2 | Yes | null |

Example:
AddressHelper.getDistanceInKm(24.8607, 67.0011, 24.8607, 67.0011); // 0

  • AddressHelper.getDistanceInMiles
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Latitude 1 | Yes | null | | Longitude 1 | Yes | null | | Latitude 2 | Yes | null | | Longitude 2 | Yes | null |

Example:
AddressHelper.getDistanceInMiles(24.8607, 67.0011, 24.8607, 67.0011); // 0

String Helper

The StringHelper is a convenient utility to manupilate Strings.

Example:
import { StringHelper } from 'node-simplify';
  • StringHelper.generatePassword
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | lengts of password | Yes | 8 |

Example:
StringHelper.generatePassword(10); // SHUH456@#$

  • StringHelper.generateUUID
Example:
StringHelper.generateUUID(); // 123e4567-e89b-12d3-a456-426614174000

  • StringHelper.generateSlug
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Text | Yes | null |

Example:
StringHelper.generateSlug("Hello World"); // hello-world

  • StringHelper.generateRandomString
Options:

| Parameter | Required | Default | | ------------- | -------- | ------- | | Integer | Yes | 10 |

Example:
StringHelper.generateRandomString(10); // aBcDeFgHiJ