This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

rjutils-collection
TypeScript icon, indicating that this package has built-in type declarations

1.8.0 • Public • Published

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.

Package Sidebar

Install

npm i rjutils-collection

Weekly Downloads

22

Version

1.8.0

License

MIT

Unpacked Size

62.3 kB

Total Files

52

Last publish

Collaborators

  • 0x4096