DEV Community

Cover image for Greet your visitor
Mayank
Mayank

Posted on • Edited on

4 1 1 1 2

Greet your visitor

Greet your Visitors with Good Morning, Good Afternoon or Good Evening Message using JavaScript

Install using npm

npm install greet-visitor
Enter fullscreen mode Exit fullscreen mode

https://www.npmjs.com/package/greet-visitor

Sample Output - with emoji

Time Range Output
>= 3 - <= 12 🌞 Good morning
>= 12 - <= 17 🌞 Good afternoon
>= 17 - <= 20 🌓 Good evening
>= 20 - <= 24 🌒 Good night
>= 23 - <= 3 🌚 Oh! working late night

Configurable Default Options

{
    "emoji": true,
    "morning": "Good Morning",
    "noon": "Good Afternoon",
    "evening": "Good Evening",
    "night": "Good Night",
    "midnight": "Oh! working late night",
}
Enter fullscreen mode Exit fullscreen mode

Sample Code

var greet = require("greet-visitor");

greet();
// Based on system default time it will show different messages. as mentioned above
Enter fullscreen mode Exit fullscreen mode

Sample Code with Option Change

var greet = require("greet-visitor");

greet({emoji: false, noon: "Good noon !"});

// Output- at noon
"Good noon !"

// Output- in morning
"Good Morning"
Enter fullscreen mode Exit fullscreen mode

Image of Docusign

Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (4)

Collapse
 
corners2wall profile image
Corners 2 Wall

Good job dude
Image description

Collapse
 
mayank30 profile image
Mayank

Thanks alot..

Collapse
 
mayank30 profile image
Mayank

Guys i have upgrade the package. added mid night support

Collapse
 
mayank30 profile image
Mayank

for discussion on Product hunt - producthunt.com/discussions/greet-...

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay