Socket
Socket
Sign inDemoInstall

rjutils-collection

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rjutils-collection

Easy and Lightweight Utilities


Version published
Weekly downloads
6
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Welcome to rjutils-collection 👋

Version Documentation Maintenance

Easy and Lightweight Utilities

🏠 Homepage

Install

# NPM
npm install rjutils-collection

# Yarn
yarn add rjutils-collection

# pNPM
pnpm add rjutils-collection

Usage

Loading an env File as object

const path = require('path')
const utils = require('rjutils-collection')

const env = utils.loadEnv(path.join(__dirname, '.env'))

Generating a Random Number in Range

const utils = require('rjutils-collection')

const min = 50
const max = 100
const number = utils.randomNum(min, max)

Generating a Random Boolean

const utils = require('rjutils-collection')

const boolean = utils.randomBol()

Generating a Random String

const utils = require('rjutils-collection')

const string = utils.randomStr({
  length: 25,
  numbers: true,
  symbols: true,
  uppercase: true,
  lowercase: true
})

Encrypting a String

const utils = require('rjutils-collection')

const result = utils.encryptString({
  text: 'Hello, World!',
  algorithm: 'sha256',
  key: '123456789',
  output: 'hex'
})

Decrypting a String

const utils = require('rjutils-collection')

const result = utils.decryptString({
  text: 'cf5ca2c244e71e33e30d07d5c13a4502!',
  algorithm: 'sha256',
  key: '123456789',
  output: 'utf8'
})

Hashing a String

const utils = require('rjutils-collection')

const result = utils.hashString({
  text: 'Hello World again!',
  algorithm: 'sha256',
  digest: 'hex'
})

Parsing Options

const utils = require('rjutils-collection')

const original = {
  ssl: true,
  maxRequests: 10000,
  other: {
    clock: true,
    date: {
      enabled: true,
      timezone: 'UTC'
    }
  }
}

const userProvided = {
  ssl: false,
  other: {
    date: {
      timezone: 'CET'
    }
  }
}

const result = utils.deepParseOptions(original, userProvided)
/**
 * {
 *   ssl: false,
 *   maxRequests: 10000,
 *   other: {
 *     clock: true,
 *     date: {
 *       enabled: true,
 *       timezone: 'CET'
 *     }
 *   }
 * }
*/

Author

👤 0x4096

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2023 0x4096.
This project is MIT licensed.

Keywords

FAQs

Package last updated on 11 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc