0.0.22 • Published 2 months ago

nilgirihub v0.0.22

Weekly downloads
-
License
MIT
Repository
-
Last release
2 months ago

NilgiriHub - A Core Component of the Nilgiri Framework

NilgiriHub is a comprehensive NPM package offering a suite of utility functions, integral to the Nilgiri framework. It's designed to enhance your Node.js development with a focus on simplicity and efficiency.

Key Features

readJSONfile(filePath)

Reads and parses a JSON file synchronously, returning the JSON object.

writeJSONFile(filePath, jsonContent)

Asynchronously writes a given JSON object to a file at the specified path.

convertXMLtoJSON(xmlfilePath, jsonPathToSave)

Converts an XML file to JSON format and saves it to a specified file path.

validatePDF(filePath)

Validates the content of a PDF file based on specific criteria (implementation detail needed).

uniqueId()

Generates a unique identifier, useful for creating distinct values in tests or applications.

readExcelFile(filePath)

Reads data from an Excel file and returns it in a structured format.

editExcelCell(filePath, sheetName, cell, value)

Edits a specific cell in an Excel file with a given value.

readExcelValues(filePath, sheetName)

Reads values from a specified sheet in an Excel file and returns them.

generateRandomString(length)

Generates a random string of a specified length, ideal for test data generation.

futureDate(days)

Calculates a future date based on the current date and a specified number of days ahead.

generateRandonNumberBasedOnLength(length)

Generates a random number of a specified length.

generateRandomPAN()

Generates a random PAN (Permanent Account Number) format string, commonly used in Indian financial contexts.

connectDataBaseAndGetResult(host, user, password, database, query, jsonFileName)

Connects to a MySQL database, executes a query, and saves the result as a JSON file.

apiRequest(method, endPoint, payload = {}, headers = {})

This function handles different HTTP/HTTPS methods and is designed to be flexible.

compareJsonSchema(sampleJsonPath, resultJsonPath)

This function Compares all keys between two JSON files and identifies differing keys.

findValueInJSON(filePath, searchKey, searchValue, targetKey)

This function handles Find a value in a JSON file based on specified criteria.

getPropertyByPath(obj, path)

This function handles Get a property in a JSON object by providing a path as String.

getPropertyAndEditByPath(obj, path, newValue)

This function handles Get and edit a property in a JSON object by providing a path.

Installation

npm install nilgirihub

Usage

To use a specific function from NilgiriHub:

const { uniqueId } = require('nilgirihub');

// Example: Using 'uniqueId'
const id = uniqueId();
console.log(id);
import nilgiriModule from "nilgirihub";;

// Example: Using 'uniqueId'
const id = await nilgiriModule.uniqueId();
console.log(id);

License

NilgiriHub is open-source software licensed under the MIT license.

Support

Thank you for choosing NilgiriHub as part of the Nilgiri framework for your Node.js utility needs!

0.0.22

2 months ago

0.0.21

3 months ago

0.0.20

3 months ago

0.0.18

4 months ago

0.0.16

4 months ago

0.0.15

4 months ago

0.0.14

4 months ago

0.0.11

4 months ago

0.0.12

4 months ago

0.0.10

5 months ago

0.0.8

5 months ago

0.0.7

5 months ago

0.0.5

5 months ago

0.0.6

5 months ago

0.0.4

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago

0.0.0

5 months ago