MCPcopy Create free account
hub / github.com/d34dman/drupal-jsonapi-params / initializeWithQueryObject

Method initializeWithQueryObject

src/index.ts:448–468  ·  view source on GitHub ↗

* Initialize with a previously stored query object. * * @category Init

(input: any)

Source from the content-addressed store, hash-verified

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.

Callers 4

cloneMethod · 0.95
initializeMethod · 0.95

Calls 1

clearMethod · 0.95

Tested by

no test coverage detected