MCPcopy Create free account
hub / github.com/angular/angular / appendAll

Method appendAll

packages/common/http/src/params.ts:238–253  ·  view source on GitHub ↗

* Constructs a new body with appended values for the given parameter name. * @param params parameters and values * @return A new body with the new value.

(params: {
    [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
  })

Source from the content-addressed store, hash-verified

236 * @return A new body with the new value.
237 */
238 appendAll(params: {
239 [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
240 }): HttpParams {
241 const updates: Update[] = [];
242 Object.keys(params).forEach((param) => {
243 const value = params[param];
244 if (Array.isArray(value)) {
245 value.forEach((_value) => {
246 updates.push({param, value: _value, op: 'a'});
247 });
248 } else {
249 updates.push({param, value: value as string | number | boolean, op: 'a'});
250 }
251 });
252 return this.clone(updates);
253 }
254
255 /**
256 * Replaces the value for a parameter.

Callers 1

params_spec.tsFile · 0.80

Calls 5

cloneMethod · 0.95
isArrayMethod · 0.80
keysMethod · 0.65
forEachMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected