peer-test
v1.0.5
Published
Esta librería es de prueba
Downloads
12
Readme
Greetings and Farewells
This Node.js library provides functions for greeting and bidding farewell, as well as calculating the elapsed time since a given date.
Installation
- Install the library along with its peer dependency Moment.js:
npm install moment
Usage
const { sayHello, sayBye, elapsedTimeSince } = require("peer-test");
// Greet someone
const helloMessage = sayHello("John");
console.log(helloMessage); // Output: {"type":"greeting","message":"Hello John","status":200}
// Bid farewell to someone
const byeMessage = sayBye("Jane");
console.log(byeMessage); // Output: {"type":"farewell","message":"Goodbye Jane","status":200}
// Calculate the time elapsed since a date
const elapsed = elapsedTimeSince(2000, 2, 7);
console.log(elapsed); // Output: "22 years ago"
Functions
sayHello(name)
Greets the person with the specified name.
- name: Name of the person to greet.
sayBye(name)
Bids farewell to the person with the specified name.
- name: Name of the person to bid farewell.
elapsedTimeSince(year, month, day)
Calculates how much time has elapsed since the specified date until the current date.
year
: Year of the date.month
: Month of the date (1 for January, 2 for February, etc.).day
: Day of the month.