@lowentry/utils 1.12.3 → 1.13.2
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/index.js +52 -32
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/src/LeUtils.js +43 -8
package/package.json
CHANGED
package/src/LeUtils.js
CHANGED
|
@@ -697,7 +697,7 @@ export const LeUtils = {
|
|
|
697
697
|
* Loops through the given elements, and returns a new array or object, with the elements that were returned from the callback.
|
|
698
698
|
*
|
|
699
699
|
* @param {*[]|object|Function} elements
|
|
700
|
-
* @param {LeUtils~__mapCallback} callback
|
|
700
|
+
* @param {LeUtils~__mapCallback} [callback]
|
|
701
701
|
* @param {boolean} [optionalSkipHasOwnPropertyCheck]
|
|
702
702
|
* @returns {*[]|object|Function}
|
|
703
703
|
*/
|
|
@@ -711,7 +711,14 @@ export const LeUtils = {
|
|
|
711
711
|
let result = [];
|
|
712
712
|
for(let index = 0; index < elements.length; index++)
|
|
713
713
|
{
|
|
714
|
-
|
|
714
|
+
if(!callback)
|
|
715
|
+
{
|
|
716
|
+
result[index] = elements[index];
|
|
717
|
+
}
|
|
718
|
+
else
|
|
719
|
+
{
|
|
720
|
+
result[index] = callback.call(elements[index], elements[index], index);
|
|
721
|
+
}
|
|
715
722
|
}
|
|
716
723
|
return result;
|
|
717
724
|
}
|
|
@@ -722,7 +729,14 @@ export const LeUtils = {
|
|
|
722
729
|
{
|
|
723
730
|
if((optionalSkipHasOwnPropertyCheck === true) || Object.prototype.hasOwnProperty.call(elements, index))
|
|
724
731
|
{
|
|
725
|
-
|
|
732
|
+
if(!callback)
|
|
733
|
+
{
|
|
734
|
+
result[index] = elements[index];
|
|
735
|
+
}
|
|
736
|
+
else
|
|
737
|
+
{
|
|
738
|
+
result[index] = callback.call(elements[index], elements[index], index);
|
|
739
|
+
}
|
|
726
740
|
}
|
|
727
741
|
}
|
|
728
742
|
return result;
|
|
@@ -745,7 +759,7 @@ export const LeUtils = {
|
|
|
745
759
|
* Loops through the given elements, and returns a new array, with the elements that were returned from the callback. Always returns an array.
|
|
746
760
|
*
|
|
747
761
|
* @param {*[]|object|Function} elements
|
|
748
|
-
* @param {LeUtils~__mapToArrayCallback} callback
|
|
762
|
+
* @param {LeUtils~__mapToArrayCallback} [callback]
|
|
749
763
|
* @param {boolean} [optionalSkipHasOwnPropertyCheck]
|
|
750
764
|
* @returns {*[]}
|
|
751
765
|
*/
|
|
@@ -759,7 +773,14 @@ export const LeUtils = {
|
|
|
759
773
|
{
|
|
760
774
|
for(let index = 0; index < elements.length; index++)
|
|
761
775
|
{
|
|
762
|
-
|
|
776
|
+
if(!callback)
|
|
777
|
+
{
|
|
778
|
+
result.push(elements[index]);
|
|
779
|
+
}
|
|
780
|
+
else
|
|
781
|
+
{
|
|
782
|
+
result.push(callback.call(elements[index], elements[index], index));
|
|
783
|
+
}
|
|
763
784
|
}
|
|
764
785
|
}
|
|
765
786
|
else if((typeof elements === 'object') || (typeof elements === 'function'))
|
|
@@ -768,7 +789,14 @@ export const LeUtils = {
|
|
|
768
789
|
{
|
|
769
790
|
if((optionalSkipHasOwnPropertyCheck === true) || Object.prototype.hasOwnProperty.call(elements, index))
|
|
770
791
|
{
|
|
771
|
-
|
|
792
|
+
if(!callback)
|
|
793
|
+
{
|
|
794
|
+
result.push(elements[index]);
|
|
795
|
+
}
|
|
796
|
+
else
|
|
797
|
+
{
|
|
798
|
+
result.push(callback.call(elements[index], elements[index], index));
|
|
799
|
+
}
|
|
772
800
|
}
|
|
773
801
|
}
|
|
774
802
|
}
|
|
@@ -791,7 +819,7 @@ export const LeUtils = {
|
|
|
791
819
|
*
|
|
792
820
|
* @param {*[]|object|Function} elements
|
|
793
821
|
* @param {LeUtils~__sortKeysComparatorCallback} comparator
|
|
794
|
-
* @param {LeUtils~__mapToArraySortedCallback} callback
|
|
822
|
+
* @param {LeUtils~__mapToArraySortedCallback} [callback]
|
|
795
823
|
* @param {boolean} [optionalSkipHasOwnPropertyCheck]
|
|
796
824
|
* @returns {*[]}
|
|
797
825
|
*/
|
|
@@ -802,7 +830,14 @@ export const LeUtils = {
|
|
|
802
830
|
let result = [];
|
|
803
831
|
for(let i = 0; i < keys.length; i++)
|
|
804
832
|
{
|
|
805
|
-
|
|
833
|
+
if(!callback)
|
|
834
|
+
{
|
|
835
|
+
result.push(elements[keys[i]]);
|
|
836
|
+
}
|
|
837
|
+
else
|
|
838
|
+
{
|
|
839
|
+
result.push(callback.call(elements[keys[i]], elements[keys[i]], keys[i]));
|
|
840
|
+
}
|
|
806
841
|
}
|
|
807
842
|
return result;
|
|
808
843
|
},
|