1.8.0 ā€¢ Published 10 months ago

rjutils-collection v1.8.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

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.

1.7.2

10 months ago

1.8.0

10 months ago

1.7.1

11 months ago

1.5.3

11 months ago

1.7.0

11 months ago

1.5.2

11 months ago

1.6.0

11 months ago

1.5.1

11 months ago

1.5.0

12 months ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.4.1

12 months ago

1.3.2

1 year ago

1.4.0

1 year ago

1.3.1

1 year ago

1.1.3

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.1.2

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago