1.0.0 • Published 7 years ago

hashquery v1.0.0

Weekly downloads
14
License
MIT
Repository
-
Last release
7 years ago

hashquery

A 1kb library to manage window.location.hash as key=value like query string

usage

http//foo.com

hashquery.set('hello', 'world');

http//foo.com#hello=world

hashquery.set('foo', 'bar');

http//foo.com#hello=world&foo=bar

var x = hashquery.get('hello'); // x = 'world'
hashquery.del('hello');

http//foo.com#foo=bar

hashquery.del('foo');

http//foo.com

install

npm install hashquery

usage

it can be included globally:

<script type="text/javascript" src="node_modules/hashquery/hashquery.iife.js"></script>
<script type="text/javascript">
    hashquery.set('hello', 'world');
    hashquery.set('foo', 'bar');
    var x = hashquery.get('hello'); // x = 'world'
</script>

it can also be used with import:

import * as hashquery from 'hashquery';

hashquery.set('hello', 'world');
hashquery.set('foo', 'bar');
var x = hashquery.get('hello'); // x = 'world'

see index.html for its usage

license

MIT