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

@fastly/as-url

v0.1.2

Published

![npm version](https://img.shields.io/npm/v/@fastly/as-url) ![npm downloads per month](https://img.shields.io/npm/dm/@fastly/as-url)

Downloads

213

Readme

@fastly/as-url

npm version npm downloads per month

AssemblyScript library to implement the WHATWG URL Standard, similar to the JavaScript URL Web API.

Installation

@fastly/as-url is available as a npm package. You can install @fastly/as-url in your AssemblyScript project by running:

npm install --save @fastly/as-url

Quick Start

This package attempts to be an implementation of the JavaScript URL Web API. Thus, the JavaScript URL Web API documentation could also act as a helpful getting started guide. However, while most features are implemented, some features are still in development (e.g URLSearchParams). Please see the reference documentation in the reference-docs directory for the full documentation.

import { URL } from '@fastly/as-url';

// Parse a complex absolute URL
const myComplexUrlString = 'https://user:[email protected]:8080/p/a/t/h?query=string#hash';
const url = new URL(myComplexUrlString);

let protocol = url.protocol; // "https:"
let username = url.username; // "user"
let password = url.password; // "pass"
let hostname = url.hostname; // "sub.example.com"
let port = url.port; // "8080"
let host = url.host; // "sub.example.com:8080"
let origin = url.origin // "https://sub.example.com:8080"
let pathname = url.pathname; // "/p/a/t/h"
let search = url.search; // "?query=string"
let hash = url.hash; // "#hash"
let href = url.href; // "https://user:[email protected]:8080/p/a/t/h?query=string#hash"

// Parse a relative URL
const relativeUrl = new URL(
  "../../p/a/t/h?query=string#hash",
  "https://fastly.com/path1/path2"
);

let relativeUrlHref = relativeUrl.href; // https://fastly.com/p/a/t/h?query=string#hash

Also, feel free to look through the tests for additional examples.

Reference API

The Reference API documentation can be found in the reference-docs/ directory.

Changelog

The changelog can be found here.

Security

If you happen to find any security issues, please see the Fastly Security Reporting Page, or feel free to send an email to: [email protected]

We plan to disclose any found security vulnerabilites per the npm security reporting guidelines. Note that communications related to security issues in Fastly-maintained OSS as described here are distinct from Fastly Security Advisories.

Motivation

This library was built to be used as a dependency for @fastly/as-compute.

This library is based on the WHATWG URL Standard and strives to match the JavaScript URL Web API that Node.js 's URL library implements.

However, the goal of this library is not to be a 1-to-1 implementation of the Node URL API. The goal of this library is to enable sharing very similar, if not identical, URL code between Fastly's Compute@Edge platform and popular JavaScript platforms like Web Browsers and Node.

License

Apache-2.0 WITH LLVM-exception