sodash-shuvo 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/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Sodash-Shuvo
2
+
3
+ A lightweight utility library inspired by Lodash, providing helpful functions for working with arrays, objects, strings and more in JavaScript.
4
+
5
+ ## Description
6
+
7
+ Sodash-Shuvo is a modern JavaScript utility library that helps you write cleaner, more maintainable code. It provides a collection of commonly used helper functions to manipulate data structures, handle type checking, and perform common programming tasks.
8
+
9
+ ## Installation
10
+
11
+ Install using npm:
12
+
13
+ ```bash
14
+ npm install sodash-shuvo
15
+ ```
16
+
17
+ Or using yarn:
18
+
19
+ ```bash
20
+ yarn add sodash-shuvo
21
+ ```
22
+
23
+ ## Usage Examples
24
+
25
+ ```javascript
26
+ const {chunk}= require('sodash-shuvo');
27
+
28
+ // Array operations
29
+ const alphabets = ['a', 'b', 'c', 'd'];
30
+ const size = 2;
31
+ console.log(chunk(alphabets, size)); //Output => [['a', 'b'], ['c', 'd']]
32
+
33
+ ```
34
+
35
+ ## Features
36
+
37
+ - Array manipulation functions
38
+ - Collection methods
39
+ - Mathematical operations
40
+
41
+ ## Contributing
42
+
43
+ Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
44
+
45
+ 1. Fork the repository
46
+ 2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
47
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
48
+ 4. Push to the branch (`git push origin feature/AmazingFeature`)
49
+ 5. Open a Pull Request
50
+
51
+ ## Support
52
+
53
+ - Create an issue on GitHub
54
+ - Email: shuvodas340985@gmail.com
55
+ - GitHub: shuvo2o
56
+
57
+ ## Keywords
58
+
59
+ `javascript`, `utilities`, `arrays`, `objects`, `strings`, `functional-programming`, `lodash-alternative`, `helper-functions`, `data-manipulation`
60
+
61
+ ## License
62
+
63
+ This project is licensed under the MIT License - see the LICENSE file for details.
64
+
65
+ ## Author's Note
66
+
67
+ Thank you for using Sodash-Shuvo! This project is maintained with ❤️ by Shuvo Chandra Das. If you find it useful, please consider giving it a star on GitHub and sharing it with others.
68
+
69
+ Special thanks to all contributors who help make this library better.
70
+
71
+ ---
72
+ Made with passion 🚀
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "sodash-shuvo",
3
+ "version": "1.0.0",
4
+ "main": "./src/index.js",
5
+ "type": "module",
6
+ "scripts": {
7
+ "test": "jest"
8
+ },
9
+ "keywords": [
10
+ "sodash",
11
+ "npm package",
12
+ "shuvo",
13
+ "sodash-shuvo"
14
+ ],
15
+ "bin": {
16
+ "sodash-shuvo": "./src/index.js"
17
+ },
18
+ "author": "Shuvo Chandra Das",
19
+ "license": "ISC",
20
+ "description": "This is a simple real-world npm package named sodash-shuvo. It's like lodash but created by Shuvo.",
21
+ "devDependencies": {
22
+ "jest": "^30.2.0"
23
+ }
24
+ }
package/src/index.js ADDED
@@ -0,0 +1,7 @@
1
+ #! /usr/bin/env node
2
+
3
+ const {chunk, } = require("./utils/array.js")
4
+ module.exports= {
5
+ chunk,
6
+
7
+ }
@@ -0,0 +1,10 @@
1
+ function chunk(array, size) {
2
+ const result = [];
3
+ for (let i = 0; i < array.length; i += size) {
4
+ result.push(array.slice(i, i + size));
5
+ }
6
+ return result;
7
+ }
8
+ module.exports ={
9
+ chunk,
10
+ }
@@ -0,0 +1,6 @@
1
+ const {chunk} = require("../src/utils/array.js");
2
+
3
+ test("chunk splits an array into smaller chunks", () => {
4
+ const array = [1, 2, 3, 4, 5];
5
+ expect(chunk(array, 2)).toEqual([[1, 2], [3, 4], [5]]);
6
+ });