/js-packtools

🍍 A small collection of tools for the development of javascript.

Primary LanguageJavaScriptMIT LicenseMIT

js-packtools

🍍 A small collection of tools for the development of javascript & NodeJS.

npm GitHub code size in bytes Travis (.org) Dependencies npm Trello Gitter


Getting Started | API Docs | help & Support | Contribute


πŸ€·β€ What is JS-PackTools?

πŸ‘¨β€πŸ« This is a repository of utilities. What started out as a couple of ideas quickly turned into a class that grouped together various types of functionality. The intention of this package is to group a set of helpers and / or utilities, to facilitate routine work, especially related to Backend in node and webScraping.

πŸ’¬ Welcome to the JS PackTools documentation. It will help you get started fast. If you're having trouble, you can find help and answers on our Gitter channel. We have also incorporated a WhatsApp group, with the entire development team if you want to be part of it.

Requirement

Installation

can you use by default npm

npm i js-packtools -S

or your can use yarn

yarn add js-packtools

how is it used

Only instances the library and ready! Parentheses at the end allow you to pass values to the constructor.

const jsPackTools = require("js-packtools")();
//ready to be used... easy, right?

You can also order only the features you need. using By using the destructuring assignment method, we can simplify things even more.

const { capitalLetter, modStart } = require("js-packtools")();

- List available functions

You can use the jsPackTools.info().names function to display a list of available functions

 jsPackTools.info().names; 

//"allEqual"
//"capitalLetter"
//"clearFolders"
//"createFolders"
//"csvToJson"
//"customDate"
//"dayOfYear"
//"deleteFile"
//"differenceDay"
//"everyOrNone"
//"formatSeconds"
// ... 

Try it yourself in https://runkit.com/embed/47xmru66fj0s

- See a details of the functions

Can use the name of function in info E.g. jsPackTools.info().customDateThis generates in response an object like this

{
    category    : "Time/Date"
    description : "It's a date control. Without parameters give the current date, use the parameters to customize its functionality."
    name        : "customDate"
    test        : null
    version     : "1.0.0"
}

Try it yourself in https://runkit.com/embed/aqbxbxzkrkdw

- Using one of these functions

In Js-PackTools each function fulfills a specific objective, but it can solve hundreds of different problems. Each function has its section in the documentation that will allow you to know in detail what the possibilities of said function are.

For example, the validateYear() function can have many implications. (see image) carbon (4)

Content list

The functions of this package are divided into categories. to make it easier to find a function that is out of line with your needs.


🧾 Arrays/Object

Functions Name version Category Description
🌱 allEqual 2.0.0 Arrays/Object This snippet checks whether all elements of the array are equal.
🌱 everyOrNone 1.0.0 Arrays/Object This snippet returns true if the predicate function returns true for a...
🌱 groupBy 1.0.0 Arrays/Object Sort the object by placing the value of the assigned property as key
🌱 objectFilter 1.1.2 Arrays/Object This fragment allows you to filter an object and return the key and it...

✍ String

Functions Name version Category Description
🌱 capitalLetter 2.0.0 String capitalize the first letter of a sentence or all letters if second par...
🌱 modEnd 1.0.1 String Using a string to create a new string with new size inverse to modStar...
🌱 modStart 1.0.1 String Using a string to create a new string with new size.

πŸ“ Path/Files

Functions Name version Category Description
🌱 clearFolders 1.0.0 Path/Files This simply clear the content a folder.
🌱 createFolders 1.0.0 Path/Files This create a folder whit sub-folder of date by default if param `with...
🌱 deleteFile 1.0.0 Path/Files Check if the file exists before deleting
🌱 getFinalPath 1.0.0 Path/Files Create structure of folders with parameters in constructor.
🌱 renameFiles 1.0.0 Path/Files This function rename a batch of files with current date or token uniqu...
🌱 validateDir 1.0.0 Path/Files Validate if there is a route. if not, create this route.

↔ convert

Functions Name version Category Description
🌱 csvToJson 1.0.0 convert This read a document CSV and convert in a Object Javascript (JSON).
🌱 jsonToCsv 1.0.1 convert Function for convert JSON to CSV

⏰ Time/Date

Functions Name version Category Description
🌱 customDate 1.0.0 Time/Date It's a date control. Without parameters give the current date, use the...
🌱 dayOfYear 1.0.0 Time/Date This snippet gets the day of the year from a Date object.
🌱 differenceDay 1.0.0 Time/Date This simply clear the content a folder.
🌱 formatSeconds 1.0.1 Time/Date This only format a value float
🌱 generateRageDate 1.0.0 Time/Date This function allows you to separate a given date in the number of day...
🌱 increaseDays 1.0.0 Time/Date Add days to date, can defined a maxDate.
🌱 objectToDate 1.0.0 Time/Date Generate a object with date details.
🌱 parseDate 1.0.1 Time/Date Using a string and a format transform the string in date.
🌱 timeToDate 1.0.1 Time/Date return the time between two dates, or a date and now
🌱 validateYear 1.0.0 Time/Date Can be current year or spend the year to validate

βœ” validate

Functions Name version Category Description
🌱 is 1.0.1 validate Is a function for evaluate to type of element

🌐 global

Functions Name version Category Description
🌱 writeLog 1.0.0 global write file .log in folder default of class.
🌱 writeLogError 1.0.0 global write file .log in folder default of class.
🌱 log 1.0.0 global It integrates the functions registry of errors and registry of executi...

🌱 Completed
πŸ”₯ In Development
πŸ’¬ proposal
β›” deprecated

You can review the details of each function bif you have any questions about where to start contributing.y clicking on their links. for more information enter DocumentaciΓ³n API.

contributor

Take a look at our document CONTRIBUTING.md to start configuring the repository. If you are looking for something to contribute. You can review our project in Trello You can also contact our channel Gitter if you have any questions about where to start contributing.

Thanks to these people who have helped and motivated to improve this tool more and more.


Diego AndrΓ©s

Gustavo Cacharuco

JesΓΊs PΓ©rez

License

this repository is under a license MIT
Copyright 2019 | All rights reserved to Jasp402