* Initialize with a previously stored query object. * * @category Init
(input: any)
| 446 | * @category Init |
| 447 | */ |
| 448 | public initializeWithQueryObject(input: any) { |
| 449 | this.clear(); |
| 450 | const keys = Object.keys(input); |
| 451 | keys.forEach(key => { |
| 452 | switch (key) { |
| 453 | case 'sort': |
| 454 | if (input.sort.length) { |
| 455 | this.data.sort = input.sort.split(','); |
| 456 | } |
| 457 | break; |
| 458 | case 'include': |
| 459 | if (input.include.length) { |
| 460 | this.data.include = input.include.split(','); |
| 461 | } |
| 462 | break; |
| 463 | default: |
| 464 | this.data[key as keyof DrupalJsonApiParamsStore] = input[key]; |
| 465 | } |
| 466 | }); |
| 467 | return this; |
| 468 | } |
| 469 | |
| 470 | /** |
| 471 | * Initialize with a previously stored query string. |
no test coverage detected