MCPcopy Create free account
hub / github.com/cloudydeno/aws-api / strings

Method strings

lib/encoding/xml.ts:65–89  ·  view source on GitHub ↗
(opts: {
    required?: R,
    optional?: O,
  })

Source from the content-addressed store, hash-verified

63 }
64
65 strings<
66 R extends {[key: string]: true},
67 O extends {[key: string]: true},
68 >(opts: {
69 required?: R,
70 optional?: O,
71 }): { [key in keyof R]: string }
72 & { [key in keyof O]: string | undefined }
73 {
74 const required: Array<keyof R> = Object.keys(opts.required ?? {});
75 const optional: Array<keyof O> = Object.keys(opts.optional ?? {});
76 type T = keyof R | keyof O;
77
78 const obj = Object.create(null);
79 const missing = new Set(required);
80 const strings: Set<T> = new Set(new Array<keyof O|keyof R>().concat(required, optional));
81 for (const child of this.children) {
82 if (strings.has(child.name)) {
83 obj[child.name as T] = child.content ?? '';
84 missing.delete(child.name);
85 }
86 }
87 if (missing.size > 0) this.throwMissingKeys(missing);
88 return obj;
89 }
90
91 throwMissingKeys(missingKeys: Iterable<string|number|symbol>): never {
92 throw new Error(`BUG: XmlNode ${JSON.stringify(this.name)

Callers 15

parseAssumedCredentialsFunction · 0.80
sqsSendMessageBatchFunction · 0.80
listGeoLocationsMethod · 0.80
listHealthChecksMethod · 0.80
listHostedZonesMethod · 0.80
listHostedZonesByNameMethod · 0.80
listHostedZonesByVPCMethod · 0.80
listTrafficPoliciesMethod · 0.80

Calls 1

throwMissingKeysMethod · 0.95

Tested by

no test coverage detected