Skip to content

anchorjs/url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anchor/URL

The URL module has utilities for URL resolution and parsing.

Install

volo
$ volo add anchorjs/url

For more information on using volo to manage JavaScript modules, visit http://volojs.org/.

Usage

Parse

Take a URL string, and return an object.

url.parse('http://www.example.com/')

Format

Take a parsed URL object, and return a formatted URL string.

url.format({ 'protocol': 'http:',
             'host': 'www.example.com',
             'pathname': '/' })

Resolve

Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag.

url.resolve('http://example.com/a', '/b');

Implements

This module conforms to the interface exported by Node's URL module.

Tests

Browser

To run tests in a browser, execute the Make target for the desired browser:

$ make test-chrome
$ make test-firefox
$ make test-safari
PhantomJS

To run headless tests from a terminal using PhantomJS:

$ make test-phantomjs

Credits

License

The MIT License

Copyright (c) 2012-2013 Jared Hanson <http://jaredhanson.net/>
Copyright Joyent, Inc. and other Node contributors.

About

Utilities for URL resolution and parsing.

Resources

License

Stars

Watchers

Forks

Packages

No packages published