Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rjweb/utils

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rjweb/utils

Easy and Lightweight Utilities

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
76
increased by94.87%
Maintainers
1
Weekly downloads
 
Created
Source

Welcome to @rjweb/utils 👋

Version Documentation Maintenance

Easy and Lightweight Utilities

🏠 Homepage

Install

# NPM
npm install @rjweb/utils

# Yarn
yarn add @rjweb/utils

# pNPM
pnpm add @rjweb/utils

Example Usage

Generating a Random Number in Range

const { number } = require('@rjweb/utils')

const min = 50
const max = 100

const result = number.generate(min, max)

Generating a Random String

const { string } = require('@rjweb/utils')

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

Encrypting a String

const { string } = require('@rjweb/utils')

const result = string.encrypt('Hello', 'secret', {
  output: 'hex'
})

Decrypting a String

const { string } = require('@rjweb/utils')

const result = string.decrypt('df4d0fe46e0210d4ef46368a6c3d56bb', 'secret', {
  input: 'hex'
})

Hashing a String

const { string } = require('@rjweb/utils')

const result = string.hash('Hello', {
  salt: 'secret',
  algorithm: 'sha256',
  output: 'hex'
})

Parsing Options

const { object } = require('@rjweb/utils')

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

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

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

Author

👤 0x7d8

🤝 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 0x7d8.
This project is MIT licensed.

Keywords

FAQs

Package last updated on 27 Aug 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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc