Socket
Socket
Sign inDemoInstall

urlgrey

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

urlgrey

urlgrey is a library for url querying and manipulation


Version published
Weekly downloads
172K
decreased by-19.1%
Maintainers
3
Weekly downloads
 
Created

What is urlgrey?

The urlgrey npm package is a utility for parsing, manipulating, and formatting URLs. It provides a fluent API for working with URLs, making it easy to construct, deconstruct, and modify URL components.

What are urlgrey's main functionalities?

Parsing URLs

This feature allows you to parse a URL string into an object that you can manipulate. The `urlgrey` function takes a URL string and returns an object representing the URL.

const urlgrey = require('urlgrey');
const url = urlgrey('http://example.com/path?query=1#hash');
console.log(url.toString());

Modifying URL Components

This feature allows you to modify different components of the URL such as the path, query string, and hash. The methods `path`, `query`, and `hash` are used to set new values for these components.

const urlgrey = require('urlgrey');
const url = urlgrey('http://example.com/path?query=1#hash');
const newUrl = url.path('/newpath').query('newquery=2').hash('newhash');
console.log(newUrl.toString());

Building URLs

This feature allows you to build a URL from scratch by setting various components like protocol, host, path, query, and hash. The fluent API makes it easy to chain these methods together.

const urlgrey = require('urlgrey');
const url = urlgrey().protocol('https').host('example.com').path('/newpath').query('newquery=2').hash('newhash');
console.log(url.toString());

Other packages similar to urlgrey

Keywords

FAQs

Package last updated on 15 Dec 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