@febin52/chunk-array-fast 1.0.0

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/LICENSE ADDED
@@ -0,0 +1 @@
1
+ MIT License
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # 📦 @febin52/chunk-array-fast
2
+
3
+ > Split array into smaller chunks.
4
+
5
+ ```ts
6
+ import { chunk } from '@febin52/chunk-array-fast';
7
+ chunk([1, 2, 3, 4], 2); // [[1, 2], [3, 4]]
8
+ ```
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ (function(e,n){typeof exports=="object"&&typeof module<"u"?n(exports):typeof define=="function"&&define.amd?define(["exports"],n):(e=typeof globalThis<"u"?globalThis:e||self,n(e.Pkg={}))})(this,function(e){"use strict";function n(i,o){if(o<=0)return[i];const f=[];for(let t=0;t<i.length;t+=o)f.push(i.slice(t,t+o));return f}e.chunk=n,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
@@ -0,0 +1,3 @@
1
+ export declare function chunk<T>(arr: T[], size: number): T[][];
2
+
3
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ function c(t, e) {
2
+ if (e <= 0) return [t];
3
+ const u = [];
4
+ for (let n = 0; n < t.length; n += e)
5
+ u.push(t.slice(n, n + e));
6
+ return u;
7
+ }
8
+ export {
9
+ c as chunk
10
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@febin52/chunk-array-fast",
3
+ "version": "1.0.0",
4
+ "description": "Split an array into smaller chunks of specified size.",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsc && vite build",
22
+ "test": "vitest run"
23
+ },
24
+ "keywords": [
25
+ "chunk",
26
+ "array",
27
+ "split",
28
+ "batch",
29
+ "paginate"
30
+ ],
31
+ "author": "Febin Francis",
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/febin52/chunk-array-fast.git"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/febin52/chunk-array-fast/issues"
39
+ },
40
+ "homepage": "https://github.com/febin52/chunk-array-fast#readme"
41
+ }