nilgirihub

0.0.22 • Public • Published

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.

NilgiriHub Logo

NilgiriHub

Enhance your Node.js projects with NilgiriHub, a versatile collection of utility methods.

npm version npm downloads license

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!

Copyright (c) 2023 Tricon Infotech

Readme

Keywords

none

Package Sidebar

Install

npm i nilgirihub

Weekly Downloads

1

Version

0.0.22

License

MIT

Unpacked Size

30.2 kB

Total Files

7

Last publish

Collaborators

  • animeshtriconinfotech