@perkos/perkos-a2a 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -16475,7 +16475,7 @@ var require_stringify = __commonJS({
16475
16475
  }
16476
16476
  if (obj === null) {
16477
16477
  if (strictNullHandling) {
16478
- return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix;
16478
+ return formatter(encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, "key", format) : prefix);
16479
16479
  }
16480
16480
  obj = "";
16481
16481
  }
@@ -16493,7 +16493,9 @@ var require_stringify = __commonJS({
16493
16493
  var objKeys;
16494
16494
  if (generateArrayPrefix === "comma" && isArray(obj)) {
16495
16495
  if (encodeValuesOnly && encoder) {
16496
- obj = utils.maybeMap(obj, encoder);
16496
+ obj = utils.maybeMap(obj, function(v) {
16497
+ return v == null ? v : encoder(v);
16498
+ });
16497
16499
  }
16498
16500
  objKeys = [{ value: obj.length > 0 ? obj.join(",") || null : void 0 }];
16499
16501
  } else if (isArray(filter)) {
@@ -16631,6 +16633,9 @@ var require_stringify = __commonJS({
16631
16633
  var sideChannel = getSideChannel();
16632
16634
  for (var i = 0; i < objKeys.length; ++i) {
16633
16635
  var key = objKeys[i];
16636
+ if (typeof key === "undefined" || key === null) {
16637
+ continue;
16638
+ }
16634
16639
  var value = obj[key];
16635
16640
  if (options.skipNulls && value === null) {
16636
16641
  continue;
@@ -16660,9 +16665,9 @@ var require_stringify = __commonJS({
16660
16665
  var prefix = options.addQueryPrefix === true ? "?" : "";
16661
16666
  if (options.charsetSentinel) {
16662
16667
  if (options.charset === "iso-8859-1") {
16663
- prefix += "utf8=%26%2310003%3B&";
16668
+ prefix += "utf8=%26%2310003%3B" + options.delimiter;
16664
16669
  } else {
16665
- prefix += "utf8=%E2%9C%93&";
16670
+ prefix += "utf8=%E2%9C%93" + options.delimiter;
16666
16671
  }
16667
16672
  }
16668
16673
  return joined.length > 0 ? prefix + joined : "";
@@ -16845,8 +16850,8 @@ var require_parse = __commonJS({
16845
16850
  }
16846
16851
  return leaf;
16847
16852
  };
16848
- var splitKeyIntoSegments = function splitKeyIntoSegments2(givenKey, options) {
16849
- var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, "[$1]") : givenKey;
16853
+ var splitKeyIntoSegments = function splitKeyIntoSegments2(originalKey, options) {
16854
+ var key = options.allowDots ? originalKey.replace(/\.([^.[]+)/g, "[$1]") : originalKey;
16850
16855
  if (options.depth <= 0) {
16851
16856
  if (!options.plainObjects && has.call(Object.prototype, key)) {
16852
16857
  if (!options.allowPrototypes) {
@@ -16855,37 +16860,56 @@ var require_parse = __commonJS({
16855
16860
  }
16856
16861
  return [key];
16857
16862
  }
16858
- var brackets = /(\[[^[\]]*])/;
16859
- var child = /(\[[^[\]]*])/g;
16860
- var segment = brackets.exec(key);
16861
- var parent = segment ? key.slice(0, segment.index) : key;
16862
- var keys = [];
16863
+ var segments = [];
16864
+ var first = key.indexOf("[");
16865
+ var parent = first >= 0 ? key.slice(0, first) : key;
16863
16866
  if (parent) {
16864
16867
  if (!options.plainObjects && has.call(Object.prototype, parent)) {
16865
16868
  if (!options.allowPrototypes) {
16866
16869
  return;
16867
16870
  }
16868
16871
  }
16869
- keys[keys.length] = parent;
16870
- }
16871
- var i = 0;
16872
- while ((segment = child.exec(key)) !== null && i < options.depth) {
16873
- i += 1;
16874
- var segmentContent = segment[1].slice(1, -1);
16875
- if (!options.plainObjects && has.call(Object.prototype, segmentContent)) {
16876
- if (!options.allowPrototypes) {
16877
- return;
16872
+ segments[segments.length] = parent;
16873
+ }
16874
+ var n = key.length;
16875
+ var open2 = first;
16876
+ var collected = 0;
16877
+ while (open2 >= 0 && collected < options.depth) {
16878
+ var level = 1;
16879
+ var i = open2 + 1;
16880
+ var close = -1;
16881
+ while (i < n && close < 0) {
16882
+ var cu = key.charCodeAt(i);
16883
+ if (cu === 91) {
16884
+ level += 1;
16885
+ } else if (cu === 93) {
16886
+ level -= 1;
16887
+ if (level === 0) {
16888
+ close = i;
16889
+ }
16878
16890
  }
16891
+ i += 1;
16892
+ }
16893
+ if (close < 0) {
16894
+ segments[segments.length] = "[" + key.slice(open2) + "]";
16895
+ return segments;
16896
+ }
16897
+ var seg = key.slice(open2, close + 1);
16898
+ var content = seg.slice(1, -1);
16899
+ if (!options.plainObjects && has.call(Object.prototype, content) && !options.allowPrototypes) {
16900
+ return;
16879
16901
  }
16880
- keys[keys.length] = segment[1];
16902
+ segments[segments.length] = seg;
16903
+ collected += 1;
16904
+ open2 = key.indexOf("[", close + 1);
16881
16905
  }
16882
- if (segment) {
16906
+ if (open2 >= 0) {
16883
16907
  if (options.strictDepth === true) {
16884
16908
  throw new RangeError("Input depth exceeded depth option of " + options.depth + " and strictDepth is true");
16885
16909
  }
16886
- keys[keys.length] = "[" + key.slice(segment.index) + "]";
16910
+ segments[segments.length] = "[" + key.slice(open2) + "]";
16887
16911
  }
16888
- return keys;
16912
+ return segments;
16889
16913
  };
16890
16914
  var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
16891
16915
  if (!givenKey) {