* Merges another set of capabilities into this instance. * @param {!(Capabilities|Map |Object )} other The other * set of capabilities to merge. * @return {!Capabilities} A self reference.
(other)
| 327 | * @return {!Capabilities} A self reference. |
| 328 | */ |
| 329 | merge(other) { |
| 330 | if (other) { |
| 331 | let otherMap |
| 332 | if (other instanceof Capabilities) { |
| 333 | otherMap = other.map_ |
| 334 | } else if (other instanceof Map) { |
| 335 | otherMap = other |
| 336 | } else { |
| 337 | otherMap = toMap(other) |
| 338 | } |
| 339 | otherMap.forEach((value, key) => { |
| 340 | this.set(key, value) |
| 341 | }) |
| 342 | return this |
| 343 | } else { |
| 344 | throw new TypeError('no capabilities provided for merge') |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | /** |
| 349 | * Deletes an entry from this set of capabilities. |