@ossintel/input-parser
v0.2.1
Published
Lightweight and extensible input query parser for resolving developer, repository, organization, and package paths across multiple ecosystems (GitHub, NPM, StackOverflow, VS Code).
Maintainers
Readme
@ossintel/input-parser
@ossintel/input-parser: Lightweight and extensible input query parser for resolving developer, repository, organization, and package paths across multiple ecosystems (GitHub, NPM, StackOverflow, VS Code).
✨ Why @ossintel/input-parser?
- Ecosystem Agnostic: Parses query strings, profiles, and URLs across GitHub, NPM, StackOverflow, VS Code, Medium, and LeetCode.
- URL Auto-Healing: Extracts platform, owner, repo, package name, or user IDs directly from browser copy-pasted URLs.
- Prefix Shortcuts: Handles intuitive prefix syntax (e.g.
org:react18-tools,npm:~isaacs,so:12345). - Fully Typed & Lightweight: Zero external dependencies, compiling to highly optimized, type-safe ESM/CJS bundles.
🚀 Usage
import { detectInput } from "@ossintel/input-parser";
// Parse a repository URL
const repo = detectInput("https://github.com/react18-tools/kosha");
// => { platform: "github", type: "repo", owner: "react18-tools", repo: "kosha", rawInput: "..." }
// Parse a GitHub Organization prefix
const org = detectInput("org:react18-tools");
// => { platform: "github", type: "org", owner: "react18-tools", rawInput: "..." }
// Parse an NPM user shortcut
const npmUser = detectInput("npm:~mayank1513");
// => { platform: "npm", type: "user", name: "mayank1513", rawInput: "..." }📦 Installation
$ pnpm add @ossintel/input-parseror
$ npm install @ossintel/input-parseror
$ yarn add @ossintel/input-parserLicense
This library is licensed under the MIT open-source license.
