npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

urley

v1.4.0

Published

A cross-platform library with a collection of handy utilites to work with URLs

Downloads

5

Readme

npm

NPM

🔍 Try out the interactive Demo on codesandbox

⚡️About

Urley, A cross-platform utility library to work with URLs. Urely has a collection of handy helpers to use when working with URLs, with just a few imports you are set.

✨ Features

  • 📦 Light Weight ~885b (gzipped)
  • 🔧 Cross platform supported
  • 🙅‍♂️ Zero dependencies
  • ✅ Fully tested and reliable
  • ⚒ CommonJS, ESM & browser standalone support

⬇ Installing urley

Using NPM

npm i urley

Using Yarn

yarn add urley

🛠 Usage

Getting familiar with the libary and you want to use some helper functions like getBaseUrl, getPathnameToObject, isAbsoluteUrl helpers e.t.c you can easily just import them the following ways.

import { isAbsolute } from 'urley';

All methods are exported as a flat namesapce so you can also call them like this

import isAbsolute from 'urley/bundle-es/isAbsolute';

or

var isAbsolute = require('urley');

and then we have the exported helpers and can already do this

isAbsolute('https://google.com');
// => true

📁 Documentation View Here

Is Absolute

returns - Boolean

  • isAbsolute - Returns Boolean if the given string is an absolute URL. https://seoclarity.net/resources/knowledgebase/difference-relative-absolute-url-15325/ see file here

Is Browser

returns - Boolean

  • isBrowser - Determines if the current runtime environment is a browser. see file here

Is Valid URL

returns - Boolean

  • isValidUrl - Returns Boolean if the given string/URL is valid. see file here

Get Base URL

parameters - url (String)

returns - String

  • getBaseUrl - Returns the current URL without any parameters. see file here

Decode URL

parameters - str (String)

returns - String

  • decodeUrl - Function decodes a Uniform Resource Identifier (URI) component previously created by decodeURIComponent or by a similar routine. see file here

Encode URL

parameters - str (String)

returns - String

  • encodeUrl - Function encodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine. see file here

Get URL Parameters

parameters - url (String)

returns - Object

  • getUrlParameters - Returns an object containing the parameters of the current URL. see file here

Get Path Name

parameters - url (String)

returns - String

  • getPathname - Returns pathname with a regex exec function see file here

Path Name To Object

parameters - url (String)

returns - Object

  • pathnameToObject - Returns pathname into an object see file here

Join URL

parameters - urls (String)

returns - String

  • joinUrl - Join all given URL segments together, then normalizes the resulting URL see file here

Window Portion

parameters - url (String)

returns - string

  • getWindowPathname - Return pathname if parameter is passed or uses the one in the current window environment. see file here

  • getWindowHost - Return host if parameter is passed or uses the one in the current window environment. see file here

  • getWindowHostName - Return hostname if parameter is passed or uses the one in the current window environment. see file here

  • getWindowHash - Return hash if parameter is passed or uses the one in the current window environment. see file here

  • getWindowHref - Return href if parameter is passed or uses the one in the current window environment. see file here

  • getWindowPort - Return port if parameter is passed or uses the one in the current window environment. see file here

  • getWindowProtocol - Return protocol if parameter is passed or uses the one in the current window environment. see file here

  • getWindowSearch - Return search if parameter is passed or uses the one in the current window environment. see file here

MIT © codewonders.dev  ·  GitHub @adenekan41 >  ·