@thinkpixellab-public/px-vue 3.0.87 → 3.0.88
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/package.json +1 -1
- package/utils/utils.js +10 -0
package/package.json
CHANGED
package/utils/utils.js
CHANGED
|
@@ -27,6 +27,16 @@ export default {
|
|
|
27
27
|
return Array.isArray(value) ? value : [value];
|
|
28
28
|
},
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* Returns a new array containing the specified number of items generated by the provided
|
|
32
|
+
* function.
|
|
33
|
+
* @param {*} count The number of items to be generated.
|
|
34
|
+
* @param {*} fn The function to be called to generate each item.
|
|
35
|
+
*/
|
|
36
|
+
arrayFill: function (count, fn) {
|
|
37
|
+
return Array.from({ count }, (_, i) => fn(i));
|
|
38
|
+
},
|
|
39
|
+
|
|
30
40
|
/**
|
|
31
41
|
* Safely gets an item from an array, otherwise returns a fallback value.
|
|
32
42
|
* @param {*} arr The array.
|