param-handler
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -28,5 +28,5 @@ interface Init { | ||
* @param value is the new value for the variable | ||
* @returns null | ||
* @returns void | ||
*/ | ||
set(name: string, value: string): void; | ||
set(name: string, value: any): void; | ||
/** this function gets a variable value | ||
@@ -33,0 +33,0 @@ * @param name is the name of the variable that you wanna get its value |
@@ -38,6 +38,10 @@ "use strict"; | ||
* @param value is the new value for the variable | ||
* @returns null | ||
* @returns void | ||
*/ | ||
PH.prototype.set = function (name, value) { | ||
this._params = locationToObj(this.specialGetter()); | ||
// check if unset then don't add it to the query | ||
if (value == undefined) | ||
if (!this._params[name]) | ||
return; | ||
this._params[name] = encodeURIComponent(value); | ||
@@ -44,0 +48,0 @@ this.specialSetter(ObjTolocation(this._params)); |
{ | ||
"name": "param-handler", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "this is a library that allowes you to control query params location search", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -56,6 +56,11 @@ import queryString = require('query-string'); | ||
* @param value is the new value for the variable | ||
* @returns null | ||
* @returns void | ||
*/ | ||
set(name: string, value: string) { | ||
set(name: string, value: any) { | ||
this._params = locationToObj(this.specialGetter()) | ||
// check if unset then don't add it to the query | ||
if (value == undefined) | ||
if (!this._params[name]) return; | ||
this._params[name] = encodeURIComponent(value) | ||
@@ -62,0 +67,0 @@ this.specialSetter(ObjTolocation(this._params)) |
22250
464