Skip to content

tonekk/hash.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hash.js

License Bower version

hash.js is a super tiny framework to handle your location.hash

Get

/*
 *  Given the following url: http://www.example.net/#!&foo=bar&array[]=1&array[]=2
 */
 
hash('foo'); // 'bar'
hash('array'); // ['1', '2']
hash(); // { foo: 'bar', array: ['1', '2'] }

Set

// Results in http://www.example.net/#!&foo=bar
hash('foo', 'bar');

// Results in http://www.example.net/#!&foo[]=bar&foo[]=baz
hash('foo', ['bar', 'baz']);

// Results in http://www.example.net/#!
hash('foo', undefined);

Testing

Tests are written using jasmine and can be executed in the browser, by browsing test/index.html. This project is too tiny for continuous integration imo.

About

hash.js is a super tiny framework to handle your location.hash

Resources

License

Stars

Watchers

Forks

Packages

No packages published