Needlessly Promiscuous, Modularize!


    0.1.2 • Public • Published


    npm version npm downloads per month

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


    @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 = '';
    const url = new URL(myComplexUrlString);
    let protocol = url.protocol; // "https:"
    let username = url.username; // "user"
    let password = url.password; // "pass"
    let hostname = url.hostname; // ""
    let port = url.port; // "8080"
    let host =; // ""
    let origin = url.origin // ""
    let pathname = url.pathname; // "/p/a/t/h"
    let search =; // "?query=string"
    let hash = url.hash; // "#hash"
    let href = url.href; // ""
    // Parse a relative URL
    const relativeUrl = new URL(
    let relativeUrlHref = relativeUrl.href; //

    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.


    The changelog can be found here.


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

    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.


    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.


    Apache-2.0 WITH LLVM-exception




    npm i @fastly/as-url

    DownloadsWeekly Downloads






    Unpacked Size

    66.4 kB

    Total Files


    Last publish


    • plindsay_fastly
    • bergieboy
    • alfonce
    • solomontang
    • drhoden-fastly
    • chicagoing
    • lgfastly
    • blane
    • triblondon
    • fgsch
    • leklund
    • pabergman
    • gschorkopf
    • andri_antonia
    • bernabas
    • philippschulte
    • thommahoney
    • psbanka
    • tundal45
    • lflores
    • rsouzafastly
    • patrickhamann
    • asergeyev
    • jasminedaly
    • cbuscher
    • akappen
    • hmorrison
    • jparrish
    • squeemishly
    • lturk
    • tomyoung
    • conniechu929
    • stevendaniels
    • briemarie
    • nilium
    • torch2424
    • hschaaf_fastly
    • johnmdonahue
    • alitorbati
    • uberfuzzyfastly
    • fashtley
    • mccurdyc
    • anachronism
    • fastly-compute-at-edge