@dereekb/util 13.0.5 → 13.0.6

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.
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@dereekb/util/fetch",
3
- "version": "13.0.5",
3
+ "version": "13.0.6",
4
4
  "peerDependencies": {
5
- "@dereekb/util": "13.0.5",
5
+ "@dereekb/util": "13.0.6",
6
6
  "make-error": "^1.3.0",
7
7
  "fast-content-type-parse": "^3.0.0"
8
8
  },
package/index.cjs.js CHANGED
@@ -5482,9 +5482,28 @@ function _unsupported_iterable_to_array$j(o, minLen) {
5482
5482
  }
5483
5483
  // MARK: Object Merging/Overriding
5484
5484
  /**
5485
- * Assigns all undefined values from one or more objects into the target object.
5486
- *
5487
- * @param object
5485
+ * Assigns all non-filtered values from one or more source objects into the target object.
5486
+ *
5487
+ * Builds a template from the source objects (in order, so later sources win) and applies it to the target.
5488
+ * By default, undefined values in the source objects are excluded from the template, so they will not override existing target values.
5489
+ *
5490
+ * @param target - The object to override values on.
5491
+ * @param config - Configuration for the override operation.
5492
+ * @param config.copy - Whether to return a shallow copy instead of mutating the target. Defaults to `false`.
5493
+ * @param config.from - One or more source objects whose values will be applied to the target.
5494
+ * @param config.filter - Optional filter to control which key/value pairs from sources are included. Defaults to filtering out `undefined` values.
5495
+ * @returns The modified target (or a copy if `copy` is `true`).
5496
+ *
5497
+ * @example
5498
+ * ```typescript
5499
+ * const target = { a: 1, b: 2 };
5500
+ * overrideInObject(target, { from: [{ a: 10, c: 3 }] });
5501
+ * // target is now { a: 10, b: 2, c: 3 }
5502
+ *
5503
+ * // undefined values in source are ignored by default:
5504
+ * overrideInObject(target, { from: [{ a: undefined, b: 99 }] });
5505
+ * // target.a remains 10, target.b becomes 99
5506
+ * ```
5488
5507
  */ function overrideInObject(target, param) {
5489
5508
  var _param_copy = param.copy, copy = _param_copy === void 0 ? false : _param_copy, from = param.from, filter = param.filter;
5490
5509
  return overrideInObjectFunctionFactory({
@@ -5493,7 +5512,27 @@ function _unsupported_iterable_to_array$j(o, minLen) {
5493
5512
  dynamic: true // using only once, so no need to use the cache
5494
5513
  })(asArray(from))(target);
5495
5514
  }
5496
- function overrideInObjectFunctionFactory(param) {
5515
+ /**
5516
+ * Creates an {@link OverrideInObjectFunctionFactory} that merges source objects into a template,
5517
+ * then applies that template to target objects.
5518
+ *
5519
+ * The template is built by iterating the source objects in order (later sources override earlier ones),
5520
+ * filtering each through the configured filter. When applied to a target, the template's values overwrite
5521
+ * corresponding keys on the target.
5522
+ *
5523
+ * By default, `undefined` values in sources are excluded from the template.
5524
+ *
5525
+ * @param config - Configuration controlling filtering, copying, and caching behavior.
5526
+ * @returns A factory function that accepts source objects and returns an override function.
5527
+ *
5528
+ * @example
5529
+ * ```typescript
5530
+ * const factory = overrideInObjectFunctionFactory({ copy: true });
5531
+ * const overrideFn = factory([{ color: 'red' }, { size: 10 }]);
5532
+ * const result = overrideFn({ color: 'blue', size: 5 });
5533
+ * // result is { color: 'red', size: 10 } (a new copy)
5534
+ * ```
5535
+ */ function overrideInObjectFunctionFactory(param) {
5497
5536
  var filter = param.filter, copy = param.copy, _param_dynamic = param.dynamic, dynamic = _param_dynamic === void 0 ? false : _param_dynamic;
5498
5537
  var filterToRelevantValuesObject = filter != null ? filterFromPOJOFunction({
5499
5538
  filter: filter,
@@ -5520,15 +5559,49 @@ function overrideInObjectFunctionFactory(param) {
5520
5559
  };
5521
5560
  }
5522
5561
  /**
5523
- * Merges all input objects into one.
5562
+ * Merges all input objects into a single object.
5563
+ *
5564
+ * Objects are applied left-to-right, so the right-most (last) item in the array has the highest priority.
5565
+ * `Maybe` values (null/undefined entries in the array) are silently ignored.
5566
+ *
5567
+ * By default, `undefined` values within each source object are excluded from the merge,
5568
+ * meaning an `undefined` value will not overwrite a previously set value.
5524
5569
  *
5525
- * The order of overrides is kept, so the right-most item in the array will have priority over all objects before it.
5570
+ * @param objects - Array of objects (or null/undefined) to merge together.
5571
+ * @param filter - Optional filter controlling which key/value pairs are included. Defaults to filtering out `undefined` values (`KeyValueTypleValueFilter.UNDEFINED`).
5572
+ * @returns A new object containing the merged result.
5526
5573
  *
5527
- * @param objects
5574
+ * @example
5575
+ * ```typescript
5576
+ * const result = mergeObjects([{ a: 1, b: 2 }, { b: 3, c: 4 }]);
5577
+ * // result is { a: 1, b: 3, c: 4 }
5578
+ *
5579
+ * // undefined values in sources do not override:
5580
+ * const result2 = mergeObjects([{ a: 1 }, { a: undefined, b: 2 }]);
5581
+ * // result2 is { a: 1, b: 2 }
5582
+ * ```
5528
5583
  */ function mergeObjects(objects, filter) {
5529
5584
  return mergeObjectsFunction(filter)(objects);
5530
5585
  }
5531
- function mergeObjectsFunction(filter) {
5586
+ /**
5587
+ * Creates a reusable {@link MergeObjectsFunction} with a pre-configured filter.
5588
+ *
5589
+ * Useful when you need to merge objects multiple times with the same filter configuration.
5590
+ * By default, `undefined` values are filtered out of the result (`KeyValueTypleValueFilter.UNDEFINED`).
5591
+ *
5592
+ * @param filter - Optional filter controlling which key/value pairs are included. Defaults to filtering out `undefined` values.
5593
+ * @returns A reusable merge function.
5594
+ *
5595
+ * @example
5596
+ * ```typescript
5597
+ * const merge = mergeObjectsFunction();
5598
+ * const result = merge([{ a: 1 }, { b: 2 }, { a: 3 }]);
5599
+ * // result is { a: 3, b: 2 }
5600
+ *
5601
+ * // With null filter to also exclude null values:
5602
+ * const mergeNoNulls = mergeObjectsFunction(KeyValueTypleValueFilter.NULL);
5603
+ * ```
5604
+ */ function mergeObjectsFunction(filter) {
5532
5605
  var overrideFn = overrideInObjectFunctionFactory({
5533
5606
  filter: filter,
5534
5607
  copy: false,
@@ -5540,20 +5613,37 @@ function mergeObjectsFunction(filter) {
5540
5613
  }
5541
5614
  // MARK: POJO
5542
5615
  /**
5543
- * Returns a copy of the input object with all undefined (and null values if filterNull=true) values filtered/removed from it.
5616
+ * Returns a copy of the input object with all `undefined` values removed.
5617
+ * When `filterNull` is `true`, `null` values are also removed.
5544
5618
  *
5545
- * @param obj
5546
- * @returns
5619
+ * This is a convenience wrapper around {@link filterOnlyUndefinedValues} and {@link filterNullAndUndefinedValues}.
5620
+ *
5621
+ * @param obj - The object to filter.
5622
+ * @param filterNull - If `true`, both `null` and `undefined` values are removed. Defaults to `false`.
5623
+ * @returns A shallow copy of the object with filtered values removed.
5624
+ *
5625
+ * @example
5626
+ * ```typescript
5627
+ * filterUndefinedValues({ a: 1, b: undefined, c: null });
5628
+ * // { a: 1, c: null }
5629
+ *
5630
+ * filterUndefinedValues({ a: 1, b: undefined, c: null }, true);
5631
+ * // { a: 1 }
5632
+ * ```
5547
5633
  */ function filterUndefinedValues(obj) {
5548
5634
  var filterNull = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
5549
5635
  var filterFn = filterNull ? filterNullAndUndefinedValues : filterOnlyUndefinedValues;
5550
5636
  return filterFn(obj);
5551
5637
  }
5552
5638
  /**
5553
- * Returns a copy of the input object with all undefined values filtered from it.
5639
+ * Pre-built filter that returns a copy of the input object with all `undefined` values removed.
5640
+ * Keys with `null` or other falsy values are retained.
5554
5641
  *
5555
- * @param obj
5556
- * @returns
5642
+ * @example
5643
+ * ```typescript
5644
+ * filterOnlyUndefinedValues({ a: 1, b: undefined, c: null });
5645
+ * // { a: 1, c: null }
5646
+ * ```
5557
5647
  */ var filterOnlyUndefinedValues = filterFromPOJOFunction({
5558
5648
  copy: true,
5559
5649
  filter: {
@@ -5561,10 +5651,14 @@ function mergeObjectsFunction(filter) {
5561
5651
  }
5562
5652
  });
5563
5653
  /**
5564
- * Returns a copy of the input object with all null and undefined values filtered from it.
5654
+ * Pre-built filter that returns a copy of the input object with all `null` and `undefined` values removed.
5655
+ * Keys with other falsy values (0, false, '') are retained.
5565
5656
  *
5566
- * @param obj
5567
- * @returns
5657
+ * @example
5658
+ * ```typescript
5659
+ * filterNullAndUndefinedValues({ a: 1, b: undefined, c: null, d: 0 });
5660
+ * // { a: 1, d: 0 }
5661
+ * ```
5568
5662
  */ var filterNullAndUndefinedValues = filterFromPOJOFunction({
5569
5663
  copy: true,
5570
5664
  filter: {
@@ -5572,10 +5666,14 @@ function mergeObjectsFunction(filter) {
5572
5666
  }
5573
5667
  });
5574
5668
  /**
5575
- * Returns a copy of the input object with all empty values filtered from it.
5669
+ * Pre-built filter that returns a copy of the input object with all empty values removed.
5670
+ * Empty values include `null`, `undefined`, empty strings (`''`), empty arrays (`[]`), and empty objects (`{}`).
5576
5671
  *
5577
- * @param obj
5578
- * @returns
5672
+ * @example
5673
+ * ```typescript
5674
+ * filterEmptyPojoValues({ a: 1, b: '', c: [], d: null, e: 'hello' });
5675
+ * // { a: 1, e: 'hello' }
5676
+ * ```
5579
5677
  */ var filterEmptyPojoValues = filterFromPOJOFunction({
5580
5678
  copy: true,
5581
5679
  filter: {
@@ -5583,10 +5681,14 @@ function mergeObjectsFunction(filter) {
5583
5681
  }
5584
5682
  });
5585
5683
  /**
5586
- * Returns a copy of the input object with all falsy and empty filtered from it.
5684
+ * Pre-built filter that returns a copy of the input object with all falsy and empty values removed.
5685
+ * Removes `null`, `undefined`, `0`, `false`, `''`, empty arrays, and empty objects.
5587
5686
  *
5588
- * @param obj
5589
- * @returns
5687
+ * @example
5688
+ * ```typescript
5689
+ * filterFalsyAndEmptyValues({ a: 1, b: false, c: 0, d: '', e: 'hello' });
5690
+ * // { a: 1, e: 'hello' }
5691
+ * ```
5590
5692
  */ var filterFalsyAndEmptyValues = filterFromPOJOFunction({
5591
5693
  copy: true,
5592
5694
  filter: {
@@ -5594,40 +5696,76 @@ function mergeObjectsFunction(filter) {
5594
5696
  }
5595
5697
  });
5596
5698
  /**
5597
- * Returns all keys that are not associated with an undefined value.
5699
+ * Pre-built function that returns all keys from a POJO whose values are not `undefined`.
5700
+ * Keys with `null` or other falsy values are included in the result.
5598
5701
  *
5599
- * @param obj
5600
- * @returns
5702
+ * @example
5703
+ * ```typescript
5704
+ * allNonUndefinedKeys({ a: 'test', b: undefined, c: null, d: 0 });
5705
+ * // ['a', 'c', 'd']
5706
+ * ```
5601
5707
  */ var allNonUndefinedKeys = findPOJOKeysFunction({
5602
5708
  valueFilter: exports.KeyValueTypleValueFilter.UNDEFINED
5603
5709
  });
5604
5710
  /**
5605
- * Returns all keys that are not associated with a falsy or empty value.
5711
+ * Pre-built function that returns all keys from a POJO whose values are not falsy or empty.
5712
+ * Excludes keys with `null`, `undefined`, `0`, `false`, `''`, empty arrays, or empty objects.
5606
5713
  *
5607
- * @param obj
5608
- * @returns
5714
+ * @example
5715
+ * ```typescript
5716
+ * allFalsyOrEmptyKeys({ a: 'test', b: false, c: 0, d: null });
5717
+ * // ['a']
5718
+ * ```
5609
5719
  */ var allFalsyOrEmptyKeys = findPOJOKeysFunction({
5610
5720
  valueFilter: exports.KeyValueTypleValueFilter.FALSY_AND_EMPTY
5611
5721
  });
5612
5722
  /**
5613
- * Returns all keys that are not associated with a null/undefined value.
5723
+ * Pre-built function that returns all keys from a POJO whose values are not `null` or `undefined`.
5724
+ * Keys with other falsy values (0, false, '') are included.
5614
5725
  *
5615
- * @param obj
5616
- * @returns
5726
+ * @example
5727
+ * ```typescript
5728
+ * allMaybeSoKeys({ a: 'test', b: undefined, c: null, d: 0 });
5729
+ * // ['a', 'd']
5730
+ * ```
5617
5731
  */ var allMaybeSoKeys = findPOJOKeysFunction({
5618
5732
  valueFilter: exports.KeyValueTypleValueFilter.NULL
5619
5733
  });
5620
5734
  // MARK: FindPOJOKeys
5621
5735
  /**
5622
- * Finds keys from the POJO that meet the filter.
5736
+ * Finds and returns keys from the POJO whose values pass the given filter.
5623
5737
  *
5624
- * @param obj
5625
- * @param filter
5626
- * @returns
5738
+ * The filter determines which values are considered "matching" — matched values have their keys included in the result.
5739
+ * For example, using `KeyValueTypleValueFilter.UNDEFINED` returns all keys whose values are NOT `undefined`.
5740
+ *
5741
+ * @param obj - The object to inspect.
5742
+ * @param filter - A {@link FilterKeyValueTuplesInput} controlling which key/value pairs match. Required (no default).
5743
+ * @returns Array of keys whose values pass the filter.
5744
+ *
5745
+ * @example
5746
+ * ```typescript
5747
+ * findPOJOKeys({ a: 1, b: undefined, c: null }, KeyValueTypleValueFilter.NULL);
5748
+ * // ['a'] — only 'a' has a non-null, non-undefined value
5749
+ * ```
5627
5750
  */ function findPOJOKeys(obj, filter) {
5628
5751
  return findPOJOKeysFunction(filter)(obj);
5629
5752
  }
5630
- function findPOJOKeysFunction(filter) {
5753
+ /**
5754
+ * Creates a reusable {@link FindPOJOKeysFunction} with a pre-configured filter.
5755
+ *
5756
+ * The returned function inspects each key/value pair on the input object and collects keys
5757
+ * whose values pass the filter.
5758
+ *
5759
+ * @param filter - A {@link FilterKeyValueTuplesInput} controlling which values match. Required (no default).
5760
+ * @returns A reusable function that returns matching keys from any input object.
5761
+ *
5762
+ * @example
5763
+ * ```typescript
5764
+ * const findDefinedKeys = findPOJOKeysFunction(KeyValueTypleValueFilter.UNDEFINED);
5765
+ * findDefinedKeys({ a: 1, b: undefined, c: 'hello' });
5766
+ * // ['a', 'c']
5767
+ * ```
5768
+ */ function findPOJOKeysFunction(filter) {
5631
5769
  var findEachMatchingKeyOnTarget = forEachKeyValueOnPOJOFunction({
5632
5770
  filter: filter,
5633
5771
  forEach: function forEach(param, i, obj, context) {
@@ -5645,16 +5783,41 @@ function findPOJOKeysFunction(filter) {
5645
5783
  }
5646
5784
  // MARK: CountPOJOKeys
5647
5785
  /**
5648
- * Finds and counts the number of keys from the POJO that meet the filter.
5786
+ * Counts the number of keys on the POJO whose values pass the given filter.
5649
5787
  *
5650
- * @param obj
5651
- * @param filter
5652
- * @returns
5788
+ * By default, counts all keys whose values are not `undefined` (`KeyValueTypleValueFilter.UNDEFINED`).
5789
+ *
5790
+ * @param obj - The object to inspect.
5791
+ * @param filter - A {@link FilterKeyValueTuplesInput} controlling which values are counted. Defaults to `KeyValueTypleValueFilter.UNDEFINED`.
5792
+ * @returns The number of keys whose values pass the filter.
5793
+ *
5794
+ * @example
5795
+ * ```typescript
5796
+ * countPOJOKeys({ a: 1, b: undefined, c: null });
5797
+ * // 2 — 'a' and 'c' are not undefined
5798
+ *
5799
+ * countPOJOKeys({ a: 1, b: undefined, c: null }, KeyValueTypleValueFilter.NULL);
5800
+ * // 1 — only 'a' is not null or undefined
5801
+ * ```
5653
5802
  */ function countPOJOKeys(obj) {
5654
5803
  var filter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : exports.KeyValueTypleValueFilter.UNDEFINED;
5655
5804
  return countPOJOKeysFunction(filter)(obj);
5656
5805
  }
5657
- function countPOJOKeysFunction() {
5806
+ /**
5807
+ * Creates a reusable {@link CountPOJOKeysFunction} with a pre-configured filter.
5808
+ *
5809
+ * By default, counts all keys whose values are not `undefined` (`KeyValueTypleValueFilter.UNDEFINED`).
5810
+ *
5811
+ * @param filter - A {@link FilterKeyValueTuplesInput} controlling which values are counted. Defaults to `KeyValueTypleValueFilter.UNDEFINED`.
5812
+ * @returns A reusable function that counts matching keys on any input object.
5813
+ *
5814
+ * @example
5815
+ * ```typescript
5816
+ * const countDefined = countPOJOKeysFunction();
5817
+ * countDefined({ a: 1, b: undefined, c: 'test' });
5818
+ * // 2
5819
+ * ```
5820
+ */ function countPOJOKeysFunction() {
5658
5821
  var filter = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : exports.KeyValueTypleValueFilter.UNDEFINED;
5659
5822
  var countEachMatchingKeyOnTarget = forEachKeyValueOnPOJOFunction({
5660
5823
  filter: filter,
@@ -5671,15 +5834,53 @@ function countPOJOKeysFunction() {
5671
5834
  };
5672
5835
  }
5673
5836
  /**
5674
- * Removes values, per the the filter config, from the input object.
5837
+ * Removes values from the input object based on the filter configuration.
5838
+ *
5839
+ * By default, removes `undefined` values and does NOT copy the object (mutates in place).
5840
+ * Pass `{ copy: true }` to get a new object without modifying the original.
5675
5841
  *
5676
- * @param obj POJO to remove undefined values from.
5677
- * @param copy Whether or not to return a copy of the input object. Default is true.
5842
+ * @param obj - The POJO to filter values from.
5843
+ * @param config - Configuration for filtering and copying behavior. Defaults to removing `undefined` values without copying.
5844
+ * @returns The filtered object (either the mutated original or a shallow copy, depending on `config.copy`).
5845
+ *
5846
+ * @example
5847
+ * ```typescript
5848
+ * // Remove undefined values (default):
5849
+ * filterFromPOJO({ a: 1, b: undefined, c: 'hello' });
5850
+ * // { a: 1, c: 'hello' }
5851
+ *
5852
+ * // Remove null and undefined values:
5853
+ * filterFromPOJO({ a: 1, b: null, c: undefined }, { filter: { valueFilter: KeyValueTypleValueFilter.NULL } });
5854
+ * // { a: 1 }
5855
+ * ```
5678
5856
  */ function filterFromPOJO(obj) {
5679
5857
  var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
5680
5858
  return filterFromPOJOFunction(config)(obj);
5681
5859
  }
5682
- function filterFromPOJOFunction() {
5860
+ /**
5861
+ * Creates a reusable {@link FilterFromPOJOFunction} with a pre-configured filter and copy behavior.
5862
+ *
5863
+ * The returned function removes key/value pairs that match the filter from the input object.
5864
+ * Internally, the filter is inverted so that matching values are deleted while non-matching values are retained.
5865
+ *
5866
+ * By default, removes `undefined` values (`KeyValueTypleValueFilter.UNDEFINED`) and does not copy (`copy: false`).
5867
+ *
5868
+ * @param config - Configuration for filtering and copying. Defaults to `{ copy: false, filter: { valueFilter: KeyValueTypleValueFilter.UNDEFINED } }`.
5869
+ * @returns A reusable filter function. The returned function also accepts a `copyOverride` argument to override the copy behavior per-call.
5870
+ *
5871
+ * @example
5872
+ * ```typescript
5873
+ * // Default: removes undefined values, mutates in place
5874
+ * const filterUndef = filterFromPOJOFunction();
5875
+ * const obj = { a: 1, b: undefined };
5876
+ * filterUndef(obj); // obj is now { a: 1 }
5877
+ *
5878
+ * // With copy and null filter:
5879
+ * const filterNulls = filterFromPOJOFunction({ copy: true, filter: { valueFilter: KeyValueTypleValueFilter.NULL } });
5880
+ * const result = filterNulls({ a: 1, b: null, c: undefined });
5881
+ * // result is { a: 1 }, original is unchanged
5882
+ * ```
5883
+ */ function filterFromPOJOFunction() {
5683
5884
  var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref_copy = _ref.copy, copy = _ref_copy === void 0 ? false : _ref_copy, tmp = _ref.filter, inputFilter = tmp === void 0 ? {
5684
5885
  valueFilter: exports.KeyValueTypleValueFilter.UNDEFINED
5685
5886
  } : tmp;
@@ -5702,19 +5903,60 @@ function filterFromPOJOFunction() {
5702
5903
  };
5703
5904
  }
5704
5905
  /**
5705
- * Convenience function from filterFromPOJOFunction with copy set to false and using the default filter.
5906
+ * Pre-built {@link FilterFromPOJOFunction} that removes `undefined` values by mutating the input object (no copy).
5907
+ *
5908
+ * Used internally as the default filter for {@link overrideInObjectFunctionFactory} when no filter is provided.
5909
+ *
5910
+ * @example
5911
+ * ```typescript
5912
+ * const obj = { a: 1, b: undefined };
5913
+ * defaultFilterFromPOJOFunctionNoCopy(obj);
5914
+ * // obj is now { a: 1 }
5915
+ * ```
5706
5916
  */ var defaultFilterFromPOJOFunctionNoCopy = filterFromPOJOFunction({
5707
5917
  copy: false
5708
5918
  });
5709
5919
  // MARK: AssignValuesToPOJO
5710
- function assignValuesToPOJO(target, obj, input) {
5920
+ /**
5921
+ * Assigns filtered values from `obj` onto `target`.
5922
+ *
5923
+ * By default, only non-`undefined` values from `obj` are assigned, and a copy of `target` is returned (the original is not mutated).
5924
+ *
5925
+ * @param target - The object to assign values onto.
5926
+ * @param obj - The source object whose matching values will be assigned.
5927
+ * @param input - Optional filter/copy configuration. Defaults to `KeyValueTypleValueFilter.UNDEFINED` with `copy: true`.
5928
+ * @returns The target with values assigned (either a copy or the original, depending on configuration).
5929
+ *
5930
+ * @example
5931
+ * ```typescript
5932
+ * const target = { a: 1, b: 2 };
5933
+ * const result = assignValuesToPOJO(target, { a: 10, b: undefined });
5934
+ * // result is { a: 10, b: 2 } (copy), target unchanged
5935
+ * ```
5936
+ */ function assignValuesToPOJO(target, obj, input) {
5711
5937
  return assignValuesToPOJOFunction(input)(target, obj);
5712
5938
  }
5713
5939
  /**
5714
- * Creates a AssignValuesToPOJOFunction from the input values.
5940
+ * Creates a reusable {@link AssignValuesToPOJOFunction} with a pre-configured filter and copy behavior.
5715
5941
  *
5716
- * @param input
5717
- * @returns
5942
+ * The returned function assigns key/value pairs from a source object onto a target, skipping pairs
5943
+ * that are filtered out. By default, `undefined` values are filtered out (`KeyValueTypleValueFilter.UNDEFINED`)
5944
+ * and the target is copied before assignment (`copy: true`).
5945
+ *
5946
+ * @param input - Filter and copy configuration. Defaults to `KeyValueTypleValueFilter.UNDEFINED` (filter undefined, copy target).
5947
+ * @returns A reusable assign function with a `_returnCopyByDefault` property indicating the configured copy behavior.
5948
+ *
5949
+ * @example
5950
+ * ```typescript
5951
+ * // Default: filters undefined, returns a copy
5952
+ * const assign = assignValuesToPOJOFunction();
5953
+ * const target = { a: 1, b: 2 };
5954
+ * const result = assign(target, { a: 10, b: undefined });
5955
+ * // result is { a: 10, b: 2 }, target is unchanged
5956
+ *
5957
+ * // With NULL filter and no copy:
5958
+ * const assignNoNulls = assignValuesToPOJOFunction({ valueFilter: KeyValueTypleValueFilter.NULL, copy: false });
5959
+ * ```
5718
5960
  */ function assignValuesToPOJOFunction() {
5719
5961
  var input = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : exports.KeyValueTypleValueFilter.UNDEFINED;
5720
5962
  var _ref;
@@ -5738,12 +5980,48 @@ function assignValuesToPOJO(target, obj, input) {
5738
5980
  }
5739
5981
  // MARK: ValuesFromPOJO
5740
5982
  /**
5741
- * Reads values from matching keys based on the filter and puts them into an array.
5983
+ * Extracts values from the POJO whose key/value pairs pass the given filter, returning them as an array.
5984
+ *
5985
+ * By default, only non-`undefined` values are included (`KeyValueTypleValueFilter.UNDEFINED`).
5986
+ *
5987
+ * @param target - The object to extract values from.
5988
+ * @param filter - A {@link FilterKeyValueTuplesInput} controlling which values are included. Defaults to `KeyValueTypleValueFilter.UNDEFINED`.
5989
+ * @returns Array of values whose key/value pairs passed the filter.
5990
+ *
5991
+ * @example
5992
+ * ```typescript
5993
+ * valuesFromPOJO({ a: 1, b: undefined, c: 'hello' });
5994
+ * // [1, 'hello']
5995
+ *
5996
+ * valuesFromPOJO({ a: 1, b: null, c: 'hello' }, KeyValueTypleValueFilter.NULL);
5997
+ * // [1, 'hello'] — null excluded
5998
+ * ```
5742
5999
  */ function valuesFromPOJO(target) {
5743
6000
  var filter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : exports.KeyValueTypleValueFilter.UNDEFINED;
5744
6001
  return valuesFromPOJOFunction(filter)(target);
5745
6002
  }
5746
- function valuesFromPOJOFunction() {
6003
+ /**
6004
+ * Creates a reusable {@link ValuesFromPOJOFunction} with a pre-configured filter.
6005
+ *
6006
+ * The returned function iterates each key/value pair on the input object, collects values
6007
+ * from pairs that pass the filter, and returns them as an array.
6008
+ *
6009
+ * By default, only non-`undefined` values are included (`KeyValueTypleValueFilter.UNDEFINED`).
6010
+ *
6011
+ * @param filter - A {@link FilterKeyValueTuplesInput} controlling which values are included. Defaults to `KeyValueTypleValueFilter.UNDEFINED`.
6012
+ * @returns A reusable function that extracts matching values from any input object.
6013
+ *
6014
+ * @example
6015
+ * ```typescript
6016
+ * const getDefinedValues = valuesFromPOJOFunction();
6017
+ * getDefinedValues({ a: 1, b: undefined, c: 'test' });
6018
+ * // [1, 'test']
6019
+ *
6020
+ * const getNonNullValues = valuesFromPOJOFunction(KeyValueTypleValueFilter.NULL);
6021
+ * getNonNullValues({ a: 1, b: null, c: undefined });
6022
+ * // [1]
6023
+ * ```
6024
+ */ function valuesFromPOJOFunction() {
5747
6025
  var filter = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : exports.KeyValueTypleValueFilter.UNDEFINED;
5748
6026
  var addValuesFromObjectToContext = forEachKeyValueOnPOJOFunction({
5749
6027
  filter: filter,
@@ -5762,10 +6040,25 @@ function valuesFromPOJOFunction() {
5762
6040
  }
5763
6041
  // MARK: Filter Keys
5764
6042
  /**
5765
- * Returns a FilterTuplesOnPOJOFunction that returns an object that contains only the input keys, or does not contain the input keys if invertFilter is true.
6043
+ * Creates a {@link FilterTuplesOnPOJOFunction} that retains only keys present in `keysToFilter`,
6044
+ * or excludes them if `invertFilter` is `true`.
5766
6045
  *
5767
- * @param keysToFilter
5768
- * @returns
6046
+ * Always returns a new object (never mutates the input).
6047
+ *
6048
+ * @param keysToFilter - The set of keys to include (or exclude when inverted).
6049
+ * @param invertFilter - When `true`, keys in `keysToFilter` are excluded instead of included. Defaults to `false`.
6050
+ * @returns A function that filters keys on any input POJO.
6051
+ *
6052
+ * @example
6053
+ * ```typescript
6054
+ * const pickAB = filterKeysOnPOJOFunction(['a', 'b']);
6055
+ * pickAB({ a: 1, b: 2, c: 3 });
6056
+ * // { a: 1, b: 2 }
6057
+ *
6058
+ * const omitAB = filterKeysOnPOJOFunction(['a', 'b'], true);
6059
+ * omitAB({ a: 1, b: 2, c: 3 });
6060
+ * // { c: 3 }
6061
+ * ```
5769
6062
  */ function filterKeysOnPOJOFunction(keysToFilter) {
5770
6063
  var invertFilter = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
5771
6064
  var keysSet = new Set(keysToFilter);
@@ -5775,7 +6068,22 @@ function valuesFromPOJOFunction() {
5775
6068
  }, invertFilter);
5776
6069
  return filterTuplesOnPOJOFunction(filterFn);
5777
6070
  }
5778
- function filterTuplesOnPOJOFunction(filterTupleOnObject) {
6071
+ /**
6072
+ * Creates a {@link FilterTuplesOnPOJOFunction} from a raw entry filter predicate.
6073
+ *
6074
+ * The returned function iterates all entries of the input object, applies the predicate,
6075
+ * and returns a new object containing only the entries that pass.
6076
+ *
6077
+ * @param filterTupleOnObject - Predicate applied to each `[key, value]` entry.
6078
+ * @returns A function that filters entries on any input POJO.
6079
+ *
6080
+ * @example
6081
+ * ```typescript
6082
+ * const keepStrings = filterTuplesOnPOJOFunction(([, value]) => typeof value === 'string');
6083
+ * keepStrings({ a: 'hello', b: 42, c: 'world' });
6084
+ * // { a: 'hello', c: 'world' }
6085
+ * ```
6086
+ */ function filterTuplesOnPOJOFunction(filterTupleOnObject) {
5779
6087
  return function(input) {
5780
6088
  var result = {};
5781
6089
  Object.entries(input).filter(filterTupleOnObject).forEach(function(tuple) {
@@ -5784,7 +6092,28 @@ function filterTuplesOnPOJOFunction(filterTupleOnObject) {
5784
6092
  return result;
5785
6093
  };
5786
6094
  }
5787
- function forEachKeyValueOnPOJOFunction(param) {
6095
+ /**
6096
+ * Creates a reusable function that iterates over filtered key/value pairs of a POJO,
6097
+ * invoking a callback for each matching pair.
6098
+ *
6099
+ * This is the low-level building block used by {@link filterFromPOJOFunction}, {@link findPOJOKeysFunction},
6100
+ * {@link countPOJOKeysFunction}, {@link assignValuesToPOJOFunction}, and {@link valuesFromPOJOFunction}.
6101
+ *
6102
+ * When no filter is provided, all key/value pairs are iterated.
6103
+ *
6104
+ * @param config - The filter and forEach callback configuration.
6105
+ * @returns A function that iterates matching key/value pairs on any input object.
6106
+ *
6107
+ * @example
6108
+ * ```typescript
6109
+ * const logDefined = forEachKeyValueOnPOJOFunction<Record<string, unknown>, void>({
6110
+ * filter: KeyValueTypleValueFilter.UNDEFINED,
6111
+ * forEach: ([key, value]) => console.log(key, value)
6112
+ * });
6113
+ * logDefined({ a: 1, b: undefined, c: 'test' });
6114
+ * // logs: 'a' 1, 'c' 'test'
6115
+ * ```
6116
+ */ function forEachKeyValueOnPOJOFunction(param) {
5788
6117
  var forEach = param.forEach, filter = param.filter;
5789
6118
  var filterKeyValues = filterKeyValueTuplesFunction(filter);
5790
6119
  return function(obj, context) {