jgchecker

2.0.1 • Public • Published

jgChecker

jg-checker is able to check data types and generate valid tokens

What is verified?

You can use jg-checker to check data entry depending on your project, you can check data like

  • Number
  • String
  • Boolean
  • Function
  • Object
  • Array

Quick Start

$ npm i jg-checker
const jgChecker = require("jg-checker");

Available functions

Checking the types of variables

checkTypeOf.string(<string>);
// Responsible for checking if the type is a String
checkTypeOf.number(<number>);
// Responsible for checking if the type is a Number
checkTypeOf.object(<object>);
// Responsible for checking if the type is an Object
checkTypeOf.fun(<fun>);
// Responsible for checking if the type is a Function
checkTypeOf.boolean(<boolean>);
// Responsible for checking if the type is a Boolean
checkTypeOf.array(<array>);
// Responsible for checking if the type is an Array

Token generation

const token = token.sing({payload}, secret, time);

// payload - A valid json
// secret - A string so that your token is unique
// time (optional) - Time for the token to inspire

------------------------------------------------------

// console.log(token) == token -> string
token.verify(token)

/* 
You will be responsible for verifying the token, from its integrity until the expiration time 
*/

// If invalid, it will return an error
token.decode(token, secret)

/* decodes the token, allowing data to be taken, such as the payload used to generate */

Author

  • Instagram
  • Git Hub

License

LICENSE

Package Sidebar

Install

npm i jgchecker

Weekly Downloads

1

Version

2.0.1

License

GPL-3.0 License

Unpacked Size

58.7 kB

Total Files

20

Last publish

Collaborators

  • 3isp0