Comparing version 2.0.0 to 2.0.1
26
index.js
@@ -7,4 +7,7 @@ 'use strict'; | ||
function Hash(window) { | ||
function Hash(window, options) { | ||
var self = this; | ||
if (!options) { | ||
options = {}; | ||
} | ||
@@ -18,2 +21,6 @@ this.window = window; | ||
this.load(); | ||
// TODO: do we ever need to escape? | ||
this.escape = | ||
options.escape === undefined | ||
? true : !!options.escape; | ||
@@ -85,8 +92,19 @@ function onHashChange(e) { | ||
var part = '' + escape(key); | ||
var part = ''; | ||
if (this.escape) { | ||
part += escape(key); | ||
} else { | ||
part += key; | ||
} | ||
if (str === undefined) { | ||
continue; | ||
} else if (str !== '') { | ||
part += '=' + escape(str); | ||
} | ||
if (str !== '') { | ||
part += '='; | ||
if (this.escape) { | ||
part += escape(str); | ||
} else { | ||
part += str; | ||
} | ||
} | ||
parts.push(part); | ||
@@ -93,0 +111,0 @@ } |
{ | ||
"name": "hashbind", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Dual Binding Library For window.location.hash", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
9345
291