MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / constructor

Method constructor

modules/data/url/url.js:130–149  ·  view source on GitHub ↗
(it = "", parts = null)

Source from the content-addressed store, hash-verified

128 #pairs = null;
129 #parts = null;
130 constructor(it = "", parts = null) {
131 if (typeof(it) == "object") {
132 this.#pairs = [];
133 if (Array.isArray(it)) {
134 for (let item of it) {
135 if (item.length != 2)
136 throw new TypeError("invalid parameter");
137 this.append(item[0], item[1]);
138 }
139 }
140 else {
141 for (let name in it)
142 this.append(name, it[name]);
143 }
144 }
145 else {
146 this.#pairs = parseQuery(it);
147 this.#parts = parts;
148 }
149 }
150 get length() {
151 return this.#pairs.length;
152 }

Callers

nothing calls this directly

Calls 2

appendMethod · 0.95
parseQueryFunction · 0.85

Tested by

no test coverage detected