Skip to content

Commit

Permalink
Merge pull request #385 from lygstate/development
Browse files Browse the repository at this point in the history
Fixes for #371
  • Loading branch information
jonathan-casarrubias authored Mar 17, 2017
2 parents aee035b + 6d0a8ae commit e5b985f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
12 changes: 4 additions & 8 deletions lib/angular2/shared/services/core/search.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,10 @@ export class JSONSearchParams {
}

private _parseParam(key: string, value: any, parent: string) {
let typeofValue:string = typeof value;

if (typeofValue !== 'object' && typeofValue !== 'array') {
return parent ? parent + '[' + key + ']=' + value
: key + '=' + value;
} else {
return parent ? this._JSON2URL(value, parent + '[' + key + ']')
: this._JSON2URL(value, key);
let processedKey = parent ? parent + '[' + key + ']' : key;
if (value && typeof value === 'object' || Array.isArray(value)) {
return this._JSON2URL(value, processedKey);
}
return processedKey + '=' + value;
}
}
12 changes: 4 additions & 8 deletions tests/ng2web/src/app/shared/sdk/services/core/search.params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,10 @@ export class JSONSearchParams {
}

private _parseParam(key: string, value: any, parent: string) {
if (typeof value !== 'object' && typeof value !== 'array') {
return parent ? parent + '[' + key + ']=' + value
: key + '=' + value;
} else if (typeof value === 'object' ||  typeof value === 'array') {
return parent ? this._JSON2URL(value, parent + '[' + key + ']')
: this._JSON2URL(value, key);
} else {
throw new Error('Unexpected Type');
let processedKey = parent ? parent + '[' + key + ']' : key;
if (value && typeof value === 'object' || Array.isArray(value)) {
return this._JSON2URL(value, processedKey);
}
return processedKey + '=' + value;
}
}

0 comments on commit e5b985f

Please sign in to comment.