Validate and parse Redis URI connection schemes. Current stable version is 1.1.2. The package provides two functions: parse() to break a Redis URI into auth, host, port, and db components, and validate() to check protocol and host presence. It is a simple, zero-dependency utility for handling Redis connection strings. Release cadence is low; last update was several years ago. Differentiators: lightweight, no external dependencies, explicit validation of URI format.
npm install redisuriNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates parsing a Redis URI with authentication, custom host, port, and database number, including validation.
Check types before using: auth is string|null; host is string; port and db are numbers.
Use try/catch around validate() or call parse() directly which also validates and returns parsed object or throws.
If you need Sentinel or TLS support, consider using ioredis's built-in URI parsing or a more comprehensive library.
Pre-decode the auth string if necessary: decodeURIComponent(uri).
Validate that the database segment is a number before trusting the output.
Ensure URI starts with 'redis://'. Example: const uri = 'redis://localhost:6379';
Provide a valid hostname, e.g., 'redis://localhost:6379'.
Add import: import { parse, validate } from 'redisuri'; (ESM) or const redisuri = require('redisuri'); (CJS).Use named imports: import { parse, validate } from 'redisuri';No dependency data recorded yet.