chore: small changes

This commit is contained in:
redhoodsu
2020-03-20 17:16:40 +08:00
parent 40e7f0ae38
commit 611f3061ed
2 changed files with 0 additions and 53 deletions

View File

@@ -871,22 +871,6 @@ castPath('a[0].b'); // -> ['a', '0', 'b']
castPath('a.b.c', {'a.b.c': true}); // -> ['a.b.c']
```
## chunk
Split array into groups the length of given size.
|Name |Desc |
|------|--------------------|
|arr |Array to process |
|size=1|Length of each chunk|
|return|Chunks of given size|
```javascript
chunk([1, 2, 3, 4], 2); // -> [[1, 2], [3, 4]]
chunk([1, 2, 3, 4], 3); // -> [[1, 2, 3], [4]]
chunk([1, 2, 3, 4]); // -> [[1], [2], [3], [4]]
```
## clamp
Clamp number within the inclusive lower and upper bounds.

View File

@@ -384,43 +384,6 @@ export var kebabCase = _.kebabCase = (function (exports) {
return exports;
})({});
/* ------------------------------ chunk ------------------------------ */
export var chunk = _.chunk = (function (exports) {
/* Split array into groups the length of given size.
*
* |Name |Desc |
* |------|--------------------|
* |arr |Array to process |
* |size=1|Length of each chunk|
* |return|Chunks of given size|
*/
/* example
* chunk([1, 2, 3, 4], 2); // -> [[1, 2], [3, 4]]
* chunk([1, 2, 3, 4], 3); // -> [[1, 2, 3], [4]]
* chunk([1, 2, 3, 4]); // -> [[1], [2], [3], [4]]
*/
/* typescript
* export declare function chunk(arr: any[], size?: number): Array<any[]>;
*/
exports = function(arr, size) {
var ret = [];
size = size || 1;
for (var i = 0, len = Math.ceil(arr.length / size); i < len; i++) {
var start = i * size;
var end = start + size;
ret.push(arr.slice(start, end));
}
return ret;
};
return exports;
})({});
/* ------------------------------ clamp ------------------------------ */
export var clamp = _.clamp = (function (exports) {