MCPcopy Index your code
hub / github.com/di-sukharev/opencommit / stringify2

Function stringify2

out/cli.cjs:28163–28261  ·  view source on GitHub ↗
(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter2, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel)

Source from the content-addressed store, hash-verified

28161 };
28162 var sentinel = {};
28163 var stringify2 = function stringify3(object, prefix, generateArrayPrefix, commaRoundTrip, allowEmptyArrays, strictNullHandling, skipNulls, encodeDotInKeys, encoder, filter2, sort, allowDots, serializeDate, format, formatter, encodeValuesOnly, charset, sideChannel) {
28164 var obj = object;
28165 var tmpSc = sideChannel;
28166 var step = 0;
28167 var findFlag = false;
28168 while ((tmpSc = tmpSc.get(sentinel)) !== void 0 && !findFlag) {
28169 var pos = tmpSc.get(object);
28170 step += 1;
28171 if (typeof pos !== "undefined") {
28172 if (pos === step) {
28173 throw new RangeError("Cyclic object value");
28174 } else {
28175 findFlag = true;
28176 }
28177 }
28178 if (typeof tmpSc.get(sentinel) === "undefined") {
28179 step = 0;
28180 }
28181 }
28182 if (typeof filter2 === "function") {
28183 obj = filter2(prefix, obj);
28184 } else if (obj instanceof Date) {
28185 obj = serializeDate(obj);
28186 } else if (generateArrayPrefix === "comma" && isArray2(obj)) {
28187 obj = utils.maybeMap(obj, function(value2) {
28188 if (value2 instanceof Date) {
28189 return serializeDate(value2);
28190 }
28191 return value2;
28192 });
28193 }
28194 if (obj === null) {
28195 if (strictNullHandling) {
28196 return encoder && !encodeValuesOnly ? encoder(prefix, defaults2.encoder, charset, "key", format) : prefix;
28197 }
28198 obj = "";
28199 }
28200 if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
28201 if (encoder) {
28202 var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults2.encoder, charset, "key", format);
28203 return [formatter(keyValue) + "=" + formatter(encoder(obj, defaults2.encoder, charset, "value", format))];
28204 }
28205 return [formatter(prefix) + "=" + formatter(String(obj))];
28206 }
28207 var values = [];
28208 if (typeof obj === "undefined") {
28209 return values;
28210 }
28211 var objKeys;
28212 if (generateArrayPrefix === "comma" && isArray2(obj)) {
28213 if (encodeValuesOnly && encoder) {
28214 obj = utils.maybeMap(obj, encoder);
28215 }
28216 objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }];
28217 } else if (isArray2(filter2)) {
28218 objKeys = filter2;
28219 } else {
28220 var keys = Object.keys(obj);

Callers 3

buildURL2Function · 0.85
setCookieFunction · 0.85

Calls 15

isArray2Function · 0.85
isNonNullishPrimitiveFunction · 0.85
formatterFunction · 0.85
pushToArrayFunction · 0.85
validateCookieNameFunction · 0.85
validateCookieValueFunction · 0.85
validateCookieMaxAgeFunction · 0.85
validateCookieDomainFunction · 0.85
validateCookiePathFunction · 0.85
toIMFDateFunction · 0.85
startsWithMethod · 0.80
includesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…